Hi All,
I am trying to achieve following two.
- Search all automated services on multiple remote system, those are in stooped.
- Start all of all of them.
I am able to extract the information for first one using following.
Get-Wmiobject -computername (get-Content c:\servers.txt) win32_service | Where-Object {($_.StartMode -eq "Auto") -and ($_.State -eq "Stopped")}|select SystemName,Name,StartMode,State,Status|ft
But I am not able to start them by using ForEach-Object {Start-Service $_.Name} at end, if I do so, it's trying to start those services on the local system.
I am able to do it on a single or multiple system by using
Get-WmiObject -ComputerName SERVER1,SERVER2 Win32_Service | Where-Object {($_.StartMode -eq "Auto") -and ($_.State -eq "Stopped")}| ForEach-Object {Start-Service $_.Name}
Help is required for this.
PS: I am very new to PS. :(