Kylo Ren
asked on
powershell foreach-obj and get-services
Hi, how do i fix either one of these commands? i get an error when i try to run it
get-service | foreach-object { if ($_.status -eq "stopped") {start-service $_}}
2nd variation
$service = get-service
get-service | foreach-object { if ($_.status -eq "stopped") {start-service $service}}
get-service | foreach-object { if ($_.status -eq "stopped") {start-service $_}}
2nd variation
$service = get-service
get-service | foreach-object { if ($_.status -eq "stopped") {start-service $service}}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.