Last active
August 29, 2015 13:56
-
-
Save benerdin/9253387 to your computer and use it in GitHub Desktop.
Delete Windows Service from command-line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sc delete <name-of-service> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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