Skip to content

Instantly share code, notes, and snippets.

@alastairtree
Created October 5, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alastairtree/c31db0574c0a4274ff3a to your computer and use it in GitHub Desktop.
Save alastairtree/c31db0574c0a4274ff3a to your computer and use it in GitHub Desktop.
Function KillTheService($ServiceName)
{
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue
if (!$service)
{
"Could not find service $ServiceName"
}
else
{
"Found service $ServiceName"
Stop-Service $ServiceName -Force
cmd /c "sc DELETE $ServiceName"
}
}
KillTheService "ServiceName"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment