Restarting Stopped Services with PowerShell

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:

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:

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:


Leave a Reply

Your email address will not be published. Required fields are marked *