test-systemhealth automation
Dear All,
I have tried to automate the health check with Exchange server 2007:
Test-SystemHealth -Roles:ClientAccess -DownloadConfigurationUpdates:$false -serverlist:server
But it seems that the output cannot redirect to a text file by using:
1) 2>&1
2) | out-file
Any suggestions for this command ?
Thanks,
Tommy
August 16th, 2011 10:42am
Hi,
To direct the output to a text file use the switch -OutFileLocation . See the command below
Test-SystemHealth -Roles:ClientAccess -DownloadConfigurationUpdates:$false -serverlist:server -OutfileLocation "C:\Output.txt"
Hope this helps
Mahendra
Free Windows Admin Tool Kit Click here and download it now
August 16th, 2011 11:16am
This here works with Exchange 2010 SP1. Just tested it, but I have no access to Exchange 2007.
$temp=Test-SystemHealth -Roles:ClientAccess -DownloadConfigurationUpdates:$false -OutData
Set-Content -Value $temp.FileData -Path c:\temp\SystemHealthOutData.xml -Encoding Byte
Test-SystemHealth
http://technet.microsoft.com/en-us/library/aa998598.aspx
MCTS: Messaging | MCSE: S+M
August 16th, 2011 11:44am
Dear All,
Thanks for your help.
The output file format is xml format and it's difficult to understand the result.
Is it possible to output text file ?
Free Windows Admin Tool Kit Click here and download it now
August 16th, 2011 11:53am
Not to my knowledge. Without the The OutData switch, the $temp variable is empty. The OutData specifies whether the output data is sent as a byte stream. When you run $temp=Test-SystemHealth -OutData, $temp contains the byte stream of the output data, and
you can covert it back to xml by using the Set-Content command.
I have found no other way to convert it. And I agree, the screen output makes a lot more sense.
But why not schedule Exchange Best Practices Analyzer scans? Thereby you can automate health checks.
How to Schedule an Exchange BPA Scan in Exchange Server 2010
http://exchangeserverpro.com/how-to-schedule-an-exchange-bpa-scan-in-exchange-server-2010MCTS: Messaging | MCSE: S+M
August 16th, 2011 12:45pm
That's a good idea. I will try to schedule Exchange Best Practices Analyzer.
I just focus on the command only :)
Thanks all of your help.
Free Windows Admin Tool Kit Click here and download it now
August 16th, 2011 4:44pm