How do I uninstall a Windows service using a PowerShell script?



As an IT administrator, it may be necessary to uninstall a Windows service using a PowerShell script. This can be done by using the Windows Management Instrumentation (WMI) command line tool.

The first step is to determine the name of the Windows service that needs to be uninstalled. This can be done by using the Get-Service cmdlet. This cmdlet will list all the services that are currently installed on the machine.

Once the name of the service has been identified, the next step is to use the WMI command to uninstall the service. To do this, open a PowerShell window and type the following command:

wmic /namespace:\\\\root\\cimv2 path win32_service where \name=''\ call delete

Replace with the name of the service that needs to be uninstalled.

Once the command is executed, the service will be uninstalled. If the service is running, it will be stopped before uninstalling.

In some cases, it may be necessary to use an additional command to ensure that the service is completely removed from the system. To do this, type the following command:

sc delete

Replace with the name of the service that needs to be uninstalled.

Once this command is executed, the service will be removed from the system. The service will no longer be listed in the list of services that are installed on the machine.

Uninstalling a Windows service using a PowerShell script is a fairly straightforward process. With the right commands, this task can be accomplished quickly and easily. By using the WMI command and the sc delete command, a service can be quickly and completely uninstalled from a machine. This can be a useful tool for IT administrators who need to remove services from their systems.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo