Microsoft released several Security Updates (SUs) for Microsoft Exchange Server to address vulnerabilities that have…
Restart Exchange services with PowerShell script
Clients are not connecting to the Exchange Server after an Exchange update. When you browse to Exchange Server OWA and ECP, it’s showing errors or a blank page. The first thing you need to check is if the Exchange services are running. Let’s have a look at the RestartExchangeServices PowerShell script that will help you to restart Exchange services and a little more.
Table of contents
Exchange update breaks Exchange services
You did install an:
After a reboot, Exchange Server is not working. Your first guess is that the Exchange Server services are not up and running. You did try another reboot, but that didn’t help reset the services’ status automatically. Another option that you already did is to restart Exchange Server services through PowerShell. But that didn’t work either. Why is that? That’s because it takes more than only Exchange Server services to be up and running.
Prepare restart Exchange services PowerShell script
Copy the following code and paste it in Notepad. Save the file type as RestartExchangeServices.ps1. You can also download the RestartExchangeServices.ps1 script (direct link).
# Automatic services
$auto = "MSExchangeADTopology",
"MSExchangeAntispamUpdate",
"MSExchangeDagMgmt",
"MSExchangeDiagnostics",
"MSExchangeEdgeSync",
"MSExchangeFrontEndTransport",
"MSExchangeHM",
"MSExchangeImap4",
"MSExchangeIMAP4BE",
"MSExchangeIS",
"MSExchangeMailboxAssistants",
"MSExchangeMailboxReplication",
"MSExchangeDelivery",
"MSExchangeSubmission",
"MSExchangeRepl",
"MSExchangeRPC",
"MSExchangeFastSearch",
"HostControllerService",
"MSExchangeServiceHost",
"MSExchangeThrottling",
"MSExchangeTransport",
"MSExchangeTransportLogSearch",
"MSExchangeUM",
"MSExchangeUMCR",
"FMS",
"IISADMIN",
"RemoteRegistry",
"SearchExchangeTracing",
"Winmgmt",
"W3SVC"
# Manual services
$man = "MSExchangePop3",
"MSExchangePOP3BE",
"wsbexchange",
"AppIDSvc",
"pla"
# Enable Services
foreach ($service in $auto) {
Set-Service -Name $service -StartupType Automatic
Write-Host "Enabling "$service
}
foreach ($service2 in $man) {
Set-Service -Name $service2 -StartupType Manual
Write-Host "Enabling "$service2
}
# Start Services
foreach ($service in $auto) {
Start-Service -Name $service
Write-Host "Starting "$service
}
Place the PowerShell script in the C:\scripts folder. If you don’t have a scripts folder, create one.
Run restart Exchange services PowerShell script
On the Exchange Server, run Windows PowerShell as administrator. Change the directory to the scripts folder and run the script. It will go through all the services in the script and set the services to manual or automatic. After that, it will start the services.
PS C:\> cd C:\scripts
PS C:\scripts> .\RestartExchangeServices.ps1
Do you get access denied errors, or it fails to start the services? Go to Windows Services Manager (services.msc) and enable the services manually.
After you run the script, try connecting to Exchange Server. This time it will work.
Read more: Install Exchange certificate with PowerShell »
Conclusion
In this article, you learned how to restart Exchange Services with PowerShell script. Most of the time, this happens after you install an Exchange update. One of the reasons is that you didn’t run the Exchange setup as administrator. The next time an Exchange update breaks your clients from connecting to Exchange Server, run the script and try again.
Did you enjoy this article? You may also like Create mailbox database in Exchange Server. Don’t forget to follow us.
Your script works wonderfully except for pla because of permission issues!
It works fine in all my environments. Try starting PowerShell as administrator and running the script.
After i run the update i restart all the services but unfortunetly i cant start the ECP
the users can use outlook wihtout any problem but the eECP is showing an unerwarter Fehler 500
can someonehelp me how to solve this problem
500
Unerwarteter Fehler
Aufgrund eines Fehlers konnte die Anforderung nicht abgeschlossen werden. Bitte versuchen Sie es noch mal.
Hello Ali
Your restart Exchange services PowerShell script works like a charm. Do you have any Ideas why this seems to happen on a regular basis, at least on my 2016 Server.
Thanks
Dean