Last weekend I had to work on a change request in a company. Our guys from the network team had to change some physical switches and the most of our physical servers which were connected to this specific switch where for around two hours north on a redundant network setting. At the same time I had to be there for emergency cases and also to do some other stuff on several servers.

It was good that almost everything went well and we had not many issues and downtimes.

In this company we have a full rack with Hyper-V servers in the virtual Exchange environment. Because of the change with the switches some of the VM had a networking issue and they were not able to connect anywhere else, even including the domain controllers. Because of this reason the most services couldn’t start anymore.

Unfortunately, the Get-Service doesn’t expose the start mode. Of course, because that would make it too easy. So, I tried to use the Get-WMIObject:

Get-WMIObject win32_service | Where-Object {$_.name -match "exchange" -and $_.startmode -eq "Auto" -and $_.state -ne "running"} | Start-Service

Of course, we can remove the name check and look for all services on the server that should be (but aren’t) started, and start them:

Get-WMIObject win32_service | Where-Object {$_.startmode -eq "Auto" -and $_.state -ne "running"} | Start-Service

In my case this was the solution which worked really smooth and all of the servers were running well after that…

 

Note: Stale Hansen says that in Skype for Business is another solution to start all needed services, he advices the following command:

Get-WMIObject win32_service -filter “name like ‘%exchange’% AND startmode=’Auto’ AND state =’Stopped'” -computer EXCH01 | Invoke-WMIMethod -name StartService