Sunday, June 13, 2010

Shutdown/Startup scripts for Microsoft Exchange Server 2010

OS: Microsoft Windows Server 2008 R2 Enterprise (64-bit)
Microsoft Exchange Server 2010

Most of my work being in Identity Management, I usually try to load as many components as I can onto a single virtual machine instance. For example: Having Oracle Identity Manager alone doesn't help me much, unless I can test provisioning to Active Directory, Exchange, Oracle Database etc.

However, the downside is that each of these services typically use a LOT of memory and so I usually install them and shut them down till required. Most services (like an Oracle Database) are easy to bring up when necessary. However, I didn't find an easy way to shut down or start up Exchange services and so decided to write my own - especially since there are about 23 services that Exchange runs! I also didn't want to have a script shutting down each of the services individually.

From what I was able to analyze, the service hierarchy is as shown below.
  • Microsoft Exchange Active Directory Topology Service
    • Exchange Address Book Service
    • Exchange Anti-Spam Update
    • Exchange EdgeSync Service
    • Exchange File Distribution Service
    • IMAP4
    • Mail Submission
    • Mailbox Assistants
    • Mailbox Replication
    • POP3
    • Protected Service Host
    • Replication Service
    • RPC Client Access Service
    • Search Indexer
    • Service Host
    • Throttling
    • Transport
    • Transport Log Search
  • Forms-Based Authentication Service
  • Exchange Server Extension for Windows Server Backup
  • Exchange Monitoring Service
  • Exchange Information Store
  • Exchange System Attendant
As you can see, just shutting down the AD Topology Service also shuts down 17 associated services with it. This leaves 5 other services to be shut down separately and allows me to write a simpler, smaller script file.

Type the following into notepad and save it as a .bat file and execute.

net stop MSExchangeADTopology /y
net stop MSExchangeFBA
net stop wsbexchange
net stop MSExchangeMonitoring
net stop MSExchangeIS
net stop MSExchangeSA

Memory usage with Exchange running: 1.09GB
Memory usage after Exchange was shut down: 552 MB

That saves me a cool half gig of RAM! :-)

2 comments:

  1. Don't we have to shutdown IIS services as users will not be able to access mails.
    net stop WinHttpAutoProxySvc /y

    ReplyDelete
  2. You can shutdown IIS if you need to deny access to the Outlook Web Application. However, there are other ways to manage this - one is to change just the index of OWA to reflect a "Undergoing Maintenanance" page so end users get something informative rather than a 404. Or you could just shut down the OWA site specifically - so you can let IIS server continue to serve other websites/applications.

    Remember: if you shut down all of IIS, everything including OWA shuts down.

    ReplyDelete