Skip to content

Instantly share code, notes, and snippets.

@benerdin
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save benerdin/9253387 to your computer and use it in GitHub Desktop.

Select an option

Save benerdin/9253387 to your computer and use it in GitHub Desktop.
Delete Windows Service from command-line
sc delete <name-of-service>
# No cmdlet exists like Remove-Service or Uninstall-Service
# so the Get-WmiObject needs to be used to get the service
# and delete it
Stop-Service -Name <name-of-service>
$service = Get-WmiObject -Query "select * from win32_process where name='<name-of-service>'"
$service.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment