Test-ServiceHealth – 1 Of 28 Test Cmdlets In Exchange 2010 SP1…

Test-ServiceHealth – the cmdlet name speaks for itself. I was at a customer site yesterday and the fact that the 3rd line engineers didn’t know anything about the test cmdlets in Exchange 2010 has motivated me to write a series of 28 articles, describing each test cmdlet, what it does and how to use it. The first one that comes to my mind is Test-ServiceHealth, a very essential & easy tool to check whether your Exchange services are running as expected.

Test-ServiceHealth cmdlet checks the state of the Exchange services running on the server and outputs whether all the required services are running or not. If a service is not running, it will show you which one it is. If you have a server with different roles, it will check the services for each role and report based on the roles.

Test-ServiceHealth Cmdlet

Though the cmdlet outputs everything we need, we can customize the syntax with exactly what we need (to know whether all required services are running). Test-ServiceHealth | ft Role, RequiredServicesRunning –autosize gives you a better output.

Formatted test-servicehealth better output

You can query the service state on a different server by specifying the server name after the “server” parameter. The syntax is Test-ServiceHealth –Server servername | ft Role, RequiredServicesRunnning –autosize.

Test-ServiceHealth Server Remote

What if you want to see whether the required services are running on all servers you have? The cmdlet doesn’t output the server name and hence a small script is required.

$servers = Get-ExchangeServer

ForEach ($server in $servers) { Write-host “Server Name is” $server.name; Test-ServiceHealth $server | ft Role, RequiredServicesRunnning –autosize }

Test-ServiceHealth Small Script

  1. Hello Sir,

    I ran the above command in my environment, but it does not display the Requiredservices running as True or False. Its just blank. Could you please advise?

    $servers = Get-ExchangeServer

    ForEach ($server in $servers) { Write-host “Server Name is” $server.name; Test-ServiceHealth $server | ft Role, RequiredServicesRunnning –autosize }

    Reply

Leave a Comment