While attempting to update to the latest CU for Exchange 2016 (on a Windows 2016 server), the process failed several times with an error (‘Cannot start service MSExchangeServiceHost on computer’) and I could not understand why. I still don’t understand why, but I did find a workaround that I felt important to share.
During the CU upgrade, all of the services are set to ‘disabled’ but for one reason or another the services do not get reset to their original start up value. Attempts to manually reset to Automatic were much too cumbersome to monitor and update considering there are over 30 services for Exchange 2016 alone.
If you are getting the ‘Cannot start service MSExchangeServiceHost on computer’ error during the CU upgrade, use the following looping script to monitor and reset the Exchange services from ‘Disabled’ to ‘Automatic’.
While (1 -le 2) { Sleep 1 ; Get-Service | Where { $_.DisplayName -Like ‘Microsoft Exchange*’ } | Set-Service –StartupType ‘Automatic’ }
When the CU completes, press CTRL+C to end the looping script and then restart the server to complete the upgrade.
Pingback: List of Exchange Server 2013 Services Installed | ODDYTEE
Thanks Todd, you’ve solved my problem I had with CU9 and CU10.
thank you so much, this helped me tremendously!
Thank you very much!!! You saved me !!! Health to you !!! Subscribed to your resource !!! Everything is very cool and useful !!!
I had this same behavior in the past on exchange 2013 when installing Exchange Security Updates (no CU) via SCCM. Download from Microsoft and install manually works fine.
It didn’t help me.
Same error:
Microsoft Exchange Server 2013 Cumulative Update 22 Unattended Setup
Copying Files…
File copy complete. Setup will now collect additional information needed for
installation.
Mailbox role: Transport service
Client Access role: Front End Transport service
Mailbox role: Client Access service
Mailbox role: Unified Messaging service
Mailbox role: Mailbox service
Management tools
Client Access role: Client Access Front End service
Performing Microsoft Exchange Server Prerequisite Check
Configuring Prerequisites COMPLETED
Prerequisite Analysis COMPLETED
Configuring Microsoft Exchange Server
Restoring Services COMPLETED
Mailbox role: Transport service FAILED
The following error was generated when “$error.Clear();
if (get-service MSExchangeServiceHost* | where {$_.name -eq “MSExchangeS
erviceHost”})
{
restart-service MSExchangeServiceHost
}
” was run: “Microsoft.PowerShell.Commands.ServiceCommandException: Servi
ce ‘Microsoft Exchange Service Host (MSExchangeServiceHost)’ cannot be started d
ue to the following error: Cannot start service MSExchangeServiceHost on compute
r ‘.’. —> System.InvalidOperationException: Cannot start service MSExchangeSer
viceHost on computer ‘.’. —> System.ComponentModel.Win32Exception: The depende
ncy service or group failed to start
— End of inner exception stack trace —
at System.ServiceProcess.ServiceController.Start(String[] args)
at Microsoft.PowerShell.Commands.ServiceOperationBaseCommand.DoStartService(S
erviceController serviceController)
— End of inner exception stack trace —“.
The Exchange Server setup operation didn’t complete. More details can be found
in ExchangeSetup.log located in the :\ExchangeSetupLogs folder.
thanx, good one, just used for fresh Exch2016 cu14 install that failed and had problems resuming
You are hero. resolved. thank you so much
what the f…… useful article!!!!!
Thank you Sir.
Brilliant fix, thank you! This issue still exists in Exchange 2016 CU19. I don’t really understand why the services keep restarting and changing status during the installation, but I think it has something to do with their state prior to the start of the upgrade. In my case, most of the services I don’t need are disabled, so setup keeps setting them back to disabled as the upgrade processes. I’m looking at “Finalizing Setup” right now thanks to this tip, so thank you!
Absolutely brilliant, Kudos, thanks so much for such a script.
yes the services go back to the state they were in before the upgrade so if the services are disabled to changes them from disabled to disabled and then fails. great script daved my bacon .
This literally saved my skin today – worked like a charm. Thank you.