Running test-servicehealth from Excel list
Hi I have a list of 20 Exchange 2007 servers in Excel that are going to be rebooted this evening. I would like to run test-servicehealth and test-mapiconnectivity against them tomorrow morning. Rather than typing each one out manually, I'd like Powershell to be able to grab them from the Excel sheet and run through each one. Does anyone know how I would do this?
March 19th, 2011 9:54am

You will beed the PowerShell script and you do not require the Excel sheet as you can spacify the server in the script. Let me check the script for you.Gulab | MCTS-MCITP Messaging: 2010 | MCTS-MCITP Messaging: 2007 | MCC 2011 | Skype: Gulab.Mallah
Free Windows Admin Tool Kit Click here and download it now
March 19th, 2011 10:17am

The easiest way would be to save the Excel data as a CSV file. Then use "import-csv" to get the names of the machines. import-csv names.csv | foreach{test-servicehealth -server $_.servername;test-mapiconnectivity -Server $_.servername} That little bit of Powershell doesn't, of course, address what you'll do with the output of the individual test-* cmdlets.--- Rich Matheisen MCSE+I, Exchange MVP
March 20th, 2011 2:23pm

import-csv names.csv | foreach{test-servicehealth -server $_.servername;test-mapiconnectivity -Server $_.servername} Looks good! Do you know how I could get the name of the server with the output so if there was a failure I would know what server failed? Thanks a lot.
Free Windows Admin Tool Kit Click here and download it now
March 20th, 2011 2:31pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics