Install and Uninstall Windows Service using PowerShell

In this article, you can learn how to Install and Uninstall Windows Service using the InstallUtil.exe utility. InstallUtil.exe is the command-line utility that is available in the .NET framework installation folder.


Install and Uninstall Windows Service using InstallUtil.exe:

The windows service applications created using .NET Framework use the command line utility InstallUtil.exe to install and uninstall the services. This tool is usually available under the Microsoft .NET framework installation path. It can vary the version number.

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe

How to install Windows services using PowerShell?

To install .NET service, you need to run the below command by using PowerShell by specifying the full path of the .NET service application.


New-Service -Name “MyService” -BinaryPathName “D:\MyApp\MyService.exe”

How to uninstall Windows services using PowerShell?

To Uninstall .NET service you need to run the below command by using PowerShell by specifying the service name only.


Remove-Service -Name “MyService”

Please note that the service entry might still be present in the registry even after uninstalling the service using the PowerShell command. In this case, you need to run the sc.exe delete to remove the entry from the registry.


sc.exe delete “MyService”

Note: The v4.0.30319 is the framework version.


– Article ends here –

If you have any questions, please feel free to share your questions or comments on the comment box below.

Recommended:   Install and Uninstall Windows Service using InstallUtil.exe
Share this:
We will be happy to hear your thoughts

Leave a reply

Troubleshootyourself
Logo