Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Search and start all automatic services, those are in stopped on multiple computers.

$
0
0

Hi All,

I am trying to achieve following two.

  1. Search all automated services on multiple remote system, those are in stooped.
  2. 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. :(


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>