Quellen:
http://exchange.sembee.info/2010/shutdown-script.asp
http://kevin-olbrich.de/alle-exchange-2013-dienste-neu-starten-bat/
Exchange 2010 Server Shutdown Script
On This Page
- Introduction – Why Use a Script to Shutdown Exchange?
- Shutdown Script
- What Does the Script Do?
- Shutdown or Restart the Server After Stopping Exchange
- Starting Exchange with a Script
Other Versions of Exchange
This article is available for other versions of Exchange:
Introduction – Why Use a Script to Shutdown Exchange?
If you are running Exchange 2010 on a domain controller, then you will find that it takes the machine a long time to shutdown. This is because the domain functionality stops quicker than Exchange, therefore Exchange is unable to write to the domain controller and has to be be „killed“ by the operating system.
This continual „killing“ of the Exchange services, instead of allowing them to shutdown gracefully is not good for the database and is one of the prime reasons for recommending that Exchange is not installed on a domain controller.
A better option is to stop the services before you begin to shutdown the server. This will also cause the server to shutdown more quickly because it isn’t waiting for the services to timeout. This can significantly decrease the shutdown/reboot time of SBS Server.
Even if you have a dedicated Exchange server, if you are using a UPS, then you may also want to shutdown the Exchange services before the UPS shuts down the OS. In many cases the domain controller may shut down before Exchange, which will cause delays as Exchange needs to communicate with the the domain controller during the shutdown process.
While you can stop the services yourself using the services administrative tool, instead use a batch script with a shortcut on the desktop.
Due to the dependencies required for some services, you can shortcut the list by stopping one service with the /y command.
Shutdown Script
Below is a sample script. Simply copy and paste it in to a new notepad document and save it as „stop-exchange.cmd“.
net stop msexchangeadtopology /y
net stop msexchangefba /y
net stop msftesql-exchange /y
net stop msexchangeis /y
net stop msexchangesa /y
net stop iisadmin /y
net stop w3svc /y
What does the script do?
net stop msexchangeadtopology /y
Stops the „Microsoft Exchange Active Directory Topology Service“ which will stop the following services
Microsoft Exchange Transport Log Search
Microsoft Exchange Transport
Microsoft Exchange Throttling
Microsoft Exchange Service Host
Microsoft Exchange Search Indexer
Microsoft Exchange RPC Client Access
Microsoft Exchange Replication
Microsoft Exchange Protected Service Host
Microsoft Exchange Mail Submission
Microsoft Exchange Mailbox Replication
Microsoft Exchange Mailbox Assistants
Microsoft Exchange File Distribution
Microsoft Exchange EdgeSync
Microsoft Exchange Anti-spam Update
Microsoft Exchange Address BookIt will also stop POP3, IMAP4 and Unified Messaging if those are enabled.
net stop msexchangefba /y
stops the „Microsoft Exchange Forms-Based Authentication“ service which does not have any dependencies
net stop msftesql-exchange /y
stops the „Microsoft Search (Exchange)“ service which does not have any dependencies
net stop msexchangeis /y
stops the „Microsoft Exchange Information Store“ service which does not have any dependencies
net stop msexchangesa /y
stops the „Microsoft Exchange System Attendant“ service which does not have any dependencies
net stop iisadmin /y
stops the IIS admin service, which does not have any dependencies.
net stop w3svc /y
stops the „World Wide Web Publishing“ service, which may have any dependencies – on SBS this will also stop the Remote Desktop Gateway service, which could kick you out of the server if you are using the RWW to access the server.
Shutdown or Restart the Server After Stopping Exchange
If you are using these scripts to shutdown Exchange before a server is shutdown (for example by a UPS) or rebooted, then you may want to fully automate the process by scripting the shutdown/restart as well. This can be easily achieved by adding an extra line to the end of the script:
Restart the server
shutdown /r /t 00
Shutdown the server
shutdown /s /t 00
Starting Exchange with a Script
Finally, you might also want a script to start Exchange again. This can be useful if you apply an update which requires a restart of the Exchange services, but don’t need to restart the server. However starting the services is a little more complex as the less number of the services are dependant on other services. Therefore more services have to be started manually. Simply copy and paste it in to a new notepad document and save it as „start-exchange.cmd“.
Remember to add POP3 and IMAP services if you are using those.
net start „World Wide Web Publishing Service“
net start „Microsoft Exchange System Attendant“
net start „Microsoft Search (Exchange)“
net start „Microsoft Exchange Information Store“
net start „Microsoft Exchange Unified Messaging“
net start „Microsoft Exchange Transport Log Search“
net start „Microsoft Exchange Transport“
net start „Microsoft Exchange Throttling“
net start „Microsoft Exchange Service Host“
net start „Microsoft Exchange Search Indexer“
net start „Microsoft Exchange RPC Client Access“
net start „Microsoft Exchange Replication“
net start „Microsoft Exchange Protected Service Host“
net start „Microsoft Exchange Mailbox Replication“
net start „Microsoft Exchange Mailbox Assistants“
net start „Microsoft Exchange Mail Submission“
net start „Microsoft Exchange Forms-Based Authentication service“
net start „Microsoft Exchange File Distribution“
net start „Microsoft Exchange EdgeSync“
net start „Microsoft Exchange Anti-spam Update“
net start „Microsoft Exchange Address Book“
Bemerkung: dieses Skript funkioniert nur mit der englischen Version. Umgearbeitet nach universell siehe anschließend: (Download meines Skripts ganz am Ende des Beitrags)
net start W3SVC
net start MSExchangeADTopology
net start MSExchangeEdgeSync
net start wsbexchange
net start MSExchangeAB
net start MSExchangeAntispamUpdate
net start MSExchangeFDS
net start MSExchangeServiceHost
net start MSExchangeThrottling
net start MSExchangeIS
net start MSExchangeMailSubmission
net start MSExchangeMailboxAssistants
net start MSExchangeMailboxReplication
net start MSExchangeRepl
net start MSExchangeRPC
net start MSExchangeSearch
net start MSExchangeSA
net start MSExchangeTransport
net start MSExchangeTransportLogSearch
net start msftesql-Exchange
net start MSExchangeMonitoring
Alle Exchange 2013-Dienste neu starten (Batch / PowerShell / .bat / .ps1)
Wer auf die Schnelle mal alle Exchange-Dienste neustarten möchte, der kann einfach folgendes in eine normale PowerShell-Konsole kopieren:
$services = Get-Service | ? { $_.name -like „MSExchange*“ -and $_.Status -eq „Running“}
foreach ($service in $services) {Restart-Service $service.name -Force}
Unter Umständen kommt eine Meldung wegen Timeout auf ausgelasteten Servern, diese kann einfach ignoriert werden.
Der Original-Beitrag:
Quick Tip: Restarting all Microsoft Exchange services
There are times when you need to restart all Exchange related services so here are 2 small scripts that will help you achieve this without going over each service in the Services mmc.
Of course restarting the “Microsoft Exchange Active Directory Topology” will restart a most of them but these 2 will restart them all.
Restarting All Running Services
This will get all services starting with MSexchange that are running and restart them.
$services = Get-Service | ? { $_.name -like „MSExchange*“ -and $_.Status -eq „Running“}
foreach ($service in $services) {Restart-Service $service.name -Force}
Restarting All Running Services with startup type Automatic
Although the above script should be enough in most cases, it will not restart any Microsoft Exchange related service that is supposed be running but is not for any reason. Here is another version of the script that would take care of this issue, note that we are looking for all services starting with MSExchange with startup type Automatic and restarting them
$services = get-wmiobject win32_service | ? {$_.name -like „MSExchange*“ -and $_.StartMode -eq „Auto“}
foreach ($service in $services) {Restart-Service $service.name -Force}
That’s it for now
via Quick Tip: Restarting all Microsoft Exchange services | zero hour sleep.
Mein Skript für Exchange 2010, Deutsch zum Download als Textfile.
Vor dem Einsatz bitte durcharbeiten und nach .cmd umbenennen. Ich übernehme keinerlei Haftung für eventuelle Schäden: