Computer Performance, Exchange 2003

Microsoft Exchange Server 2003 - Rapid Reboot

Introduction to Exchange Server 2003 Rapid Reboot

Have you noticed that of all the servers in all the world, that Exchange 2003 server takes the longest time to reboot?  This tendency is worst if the Exchange Server is on a Domain Controller, and there are no other Domain Controllers - a classic test network scenario.

Topics for Exchange Server 2003 Rapid Reboot

Mission to shutdown Exchange 2003 quickly

The principle is that if you stop the Exchange Service before you reboot the server, then the reboot is much quicker.  It seems as though if you just shut down an Exchange server which is also a Domain Controller, then operating system wants to find other Domain Controllers and tell them that it is shutting down Exchange, this results in a considerable time-out.

Here are the services that you should shutdown, before you restart the operating system:

MSexchangeIS - Store also called information store
MSexchangeMTA - Message transfer agent for routing
MSexchangeSA - System Attendant
MSexchangeSRS - Site replication service

Now you could shutdown these services manually, but its more fun to use a VBScript.


TrainSignal - Guy's recommended training videos for Exchange 2003Exchange Server 2007 is a complex topic, do you need practical hands on training?  As an MCT trainer, I can thoroughly recommend TrainSignal.  In particular, I like the way that TrainSignal cover all learning methods, instructor lead, video and of course text material.  You can either take one module, for example Exchange 2007 or go for a combination of modules.  Learn more about Microsoft Exchange Server 2007 here


Example - To Shutdown Exchange 200x server

Please realize that my script will shutdown your Exchange services.  So either run it on test server, or change the values for strExServiceX to relatively harmless services like Alerter or BITS.

Instructions

  1. Copy and paste the script below into notepad.
  2. Save the file with .vbs extension e.g. StopService.vbs
  3. Double click and then check the message box.
  4. Check the Services.
  5. Note: This script does not shutdown the server, so either reboot manually or add extra code as explained in the Challenges.
  6. Note: If you do not have an Exchange 200x server, then alter the strExServices to Alerter, BITS or other suitable services.

 

 

' StopService.vbs
' Author Guy Thomas http://computerperformance.co.uk
' Version 2.7 - March 2005
' ----------------------------------------'
'
Option Explicit
Dim objService, objWMI, colListOfServices, intExSrv
Dim strExService1, strExService2, strExService3, strExService4
Dim strComp, strWMIsrv

'  Amend strExService if you do not have exchange e.g. Alerter
strExService1 = "MSexchangeIS"
strExService2 = "MSexchangeMTA"
strExService3 = "MSexchangeSA"
strExService4 = "MSexchangeSRS"
intExSrv = 1

' Loops through all the Exchange services
' Uses Select Case rather than If then Elseif, end if.
For intExSrv = 1 To 4
   Select Case intExSrv
      Case 1 strWMIsrv = strExService1
      Case 2 strWMIsrv = strExService2
      Case 3 strWMIsrv = strExService3
      Case 4 strWMIsrv = strExService4
   End Select

WScript.Echo "strWMIsrv = " & strWMIsrv

' Section using WMI to interrogate the services
' Note "." means local computer.
' Note strWMIsrv in Line 37 (ish)

strComp = "."
Set objWMI = GetObject("winmgmts:\\" & strComp & "\root\cimv2")
Set colListOfServices = objWMI.ExecQuery("Select * from " _
& "Win32_Service Where Name ='" & strWMIsrv & "'")

'  See how it cycles through colListofServices until it gets a match
'  Then stops the objService
     For Each objService in colListOfServices
     objService.StopService()
     Next
Next
WScript.Echo "Now check: Services, MS Exchange xx" & vbCr _
& "This script cuts the time it takes to reboot your Exchange server."

WScript.Quit

' End of Script

 

Learning Points

Note 1:  I am fond of Select Case, where ever possible I use this construction in preference to endless: if, then, elseif, elseif, elseif, endif. 

Note 2: The heart of the script is GetObject("winmgmts...)  Here is where VBScript employs WMI to manipulate the operating system.

Note 3: Many of these WMI scripts use collations. (Like a collection.)  Observe the:  For Each objService in colListOfServices

Challenges

Amend the script to start services.  Starting the services is fun for testing, useful in production.  Example, change line 41 (ish) objService.StartService()

Add a shutdown command at the end of the script, for example:
shutdown /l /t:20 /r  (Lower case L means local, t means time delay in seconds, r means reboot).  See more in Ezine 45 shutdown command

Exchange Monitor from SolarWindsGuy Recommends: The SolarWinds Exchange Monitor

Here is a free tool to monitor your Exchange Server.  Download and install the utility, then inspect your mail queues, monitor the Exchange server's memory, confirm there is enough disk space and check the CPU utilization. This is the real deal - there is no catch.  SolarWinds provides this fully-functioning product for free, as part of their commitment to supporting the network management community.

Free Download of SolarWinds Exchange Monitor

.

Summary - Shutdown Exchange Services

You may have noticed that Exchange takes much longer to shutdown than other servers, for example SQL or even Windows 2003.  This problem is worse where Exchange is on a Domain Controller.  The trick is to shutdown the Exchange Services before you shutdown the Windows services.  We achieve this mission with a classic VBScript.


Download your Exchange 2003 Disaster Recovery and Troubleshooting eBook for only $9.95

Exchange 2003 Disaster Recovery and Troubleshooting EbookThe extra features you get in your eBook include:  'How to...' sections with screen shots.  Checklists to prepare your migration plan.

Lots of tips, recommendations and troubleshooting advice.  Printer friendly pages in both PDF and Word format.

 

See Also

 .


Google

Webcomputerperformance.co.uk

GFi Events Manager

Guy Recommends: GFi EventsManager

Here is a solution to monitor, manage and archive thousands of events that are generated by devices across your entire network.  Get your free evaluation copy of GFI EventsManager.

 

Home Copyright © 1999-2008 Computer Performance LTD All rights reserved

Please report a broken link, or an error.