Skip to content

Instantly share code, notes, and snippets.

@slimflem
Created September 1, 2013 21:14
Show Gist options
  • Select an option

  • Save slimflem/6407348 to your computer and use it in GitHub Desktop.

Select an option

Save slimflem/6407348 to your computer and use it in GitHub Desktop.
Checks for the existence of and deletes a Windows Service.
if (Get-Service "MyCustomService" -ErrorAction SilentlyContinue) {
sc.exe delete MyCustomService | Write-Host
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment