Skip to content

Instantly share code, notes, and snippets.

@djhohnstein
Created April 17, 2019 15:48
Show Gist options
  • Save djhohnstein/89f82ff9eff298f41351ffbe05065b9e to your computer and use it in GitHub Desktop.
Save djhohnstein/89f82ff9eff298f41351ffbe05065b9e to your computer and use it in GitHub Desktop.
Gist to start and stop services in a "fine-grained" manner
$services = Get-Service | % { $_.Name }
ForEach($service in $services)
{
Write-Host "Stopping $service"
sc.exe stop $service
Write-Host "Hit any key to start $service"
Read-Host
sc.exe start $service
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment