Brilliant One Dave! Thank You very much! It really made the one liner script work, but now I have a new problem….
After doing the one-liner script, though it started the services on remote computers, but when I tried to retrieve the data whether it worked or not, through the next line command
“Get-WmiObject win32_service -Filter “startmode = ‘auto’ and state != ‘running’” -computername (Get-Content C:\ServerList.txt) | Select-Object Name, State, Status”
(Believe me, I again couldn’t figure out, how to check the value of $result.Returnvalue as advised by you above….. Still learning Powershell )
I got list of services like the below:
Name Status State
—- —— —–
clr_optimization_v4.0.30319_32 OK Stopped
clr_optimization_v4.0.30319_64 OK Stopped
gupdate OK Stopped
CTXCPUBal OK Stopped
gupdate OK Stopped
clr_optimization_v4.0.30319_32 OK Stopped
clr_optimization_v4.0.30319_64 OK Stopped
Though they might have started and stopped, but in the list of 20 servers, how to find out on which server it really didn’t start…
Is there anyway to get the respective Server Name along with the above output?