Get-Service
instead of WMI. It offers the same information but allows you to then pass those objects into
Stop-Service
and
Start-Service
. So you can just use this to get the status of the services on your servers: $servList = gc Mylist.txt Get-Service -Name *SQL* -Exclude *AD*,*Browser,*Writer -ComputerName $servList | Select @{Lable="ServerName";Expression={$_}}, Name, DisplayName, Status I could add how to go about doing the start/stop with the output of above, however I am going to refrain from it. You need to understand what it does and how, and the best way is by figuring that part out on your own.
17 People are following this question.