error with this - please help

I am trying to get a list of all services on a list of servers (servers.txt) that have a startmode of auto and state stopped

$servers = get-content c:\servers.txt

foreach ($server in $servers)

{ get-wmiobject win32_service -computername $server | `

where {$_.State -eq "Stopped" -and $_startmode -eq "auto"}

} | select systemname, state, displayname, startmode

but got error

An empty pipe element is not allowed

any idea?

but if I run it manually for one server it works fine


September 8th, 2015 2:38pm

Put it in the ISE and you'll see where your probl

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 2:42pm

Please read the following:
September 8th, 2015 2:44pm

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

Other recent topics Other recent topics