I have 15 services across 3 servers that I have to stop in a specific order and start in a specific order.
Here is what I have so far..
$services = Import-Csv "aspect_services.csv"
foreach($entry in $services) {
$server = $entry.Server
$service = $entry.service
C:\Users\davidf\Downloads\SysinternalsSuite\psexec.exe
\\$Server net stop $service
}
Instead I'd like to do something with the Get-Service command. Can I run a Get-Service on a remote machine? How? I'd like to get the status of the service and if it isn't stopped then try to stop it.