locked
test-systemhealth automation RRS feed

  • Question

  • 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

    Tuesday, August 16, 2011 7:42 AM

Answers

  • 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

    • Marked as answer by Tommyckt Tuesday, August 16, 2011 1:45 PM
    Tuesday, August 16, 2011 8:16 AM
  • 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-2010


    MCTS: Messaging | MCSE: S+M
    • Marked as answer by Tommyckt Tuesday, August 16, 2011 1:44 PM
    Tuesday, August 16, 2011 9:45 AM

All replies

  • 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

    • Marked as answer by Tommyckt Tuesday, August 16, 2011 1:45 PM
    Tuesday, August 16, 2011 8:16 AM
  • 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
    Tuesday, August 16, 2011 8:44 AM
  • 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 ?

    Tuesday, August 16, 2011 8:53 AM
  • 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-2010


    MCTS: Messaging | MCSE: S+M
    • Marked as answer by Tommyckt Tuesday, August 16, 2011 1:44 PM
    Tuesday, August 16, 2011 9:45 AM
  •  

    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.

    Tuesday, August 16, 2011 1:44 PM