Friday, January 17, 2014

Restart Exchange Service on Multiple Server using Powershell Command

Restart Exchange Service on Multiple Server using Powershell Command

Microsoft Exchange Service can be restarted using services.msc graphical console. But using powershell command it makes the job easier.

To check list of service use the following powershell command

Get-Service -ComputerName | Sort-Object Status

To restart Netlogon service on single computer

Get-Service -ComputerName -Name Netlogon | Restart-Service

To Stop MSExchangeUM service for group of computer

Create computer.txt file on list the servers name on it and save in C drive as computer.txt file

Server1
Server2
Server3

Then run the following command based upon your requirement

Get-Content C:\Computer.txt | ForEach-Object { Stop-Service -InputObject $(Get-Service -Computer $_ -Name MSExchangeUM ) }
To Start MSExchangeUMCR service for group of computer

Get-Content C:\Computer.txt | ForEach-Object { Start-Service -InputObject $(Get-Service -Computer $_ -Name MSExchangeUMCR ) }
To Restart the service which is equal to stop and start the service

Get-Content C:\Computer.txt | ForEach-Object { Restart-Service -InputObject $(Get-Service -Computer $_ -Name netlogon) }

No comments:

Post a Comment

The blog is written to the share the knowledge mainly on Microsoft Exchange Server and other Microsoft product that experienced on day-to-day life.