Delete a Windows Service with the Command Line or PowerShell

In this post, I’ll demonstrate using the sc delete Windows command and the Remove-Service PowerShell command to delete a Windows Service.

How to Delete a Windows Service from the Command Line

Step 1. Find the Service Name

Open Windows Services, find the service name, right click and select properties.

Copy the service name.

Step 2. Run the sc delete command

Open the command line as administrator.

Next, run the below command. Replace “servicename” with the service name from Step 1.

sc delete servicename

You should get DeleteService SUCCESS message.

You might need to reboot the computer for the service to be completely removed.

That completes the steps for deleting a windows service using the sc command.

How to Delete a Windows Service Using PowerShell

Requirements: You will need to be running at least PowerShell version 6 for this command to work. Refer to the updating PowerShell guide for steps on upgrading PowerShell to the latest version.

Step 1. You will need the service name

Open Windows services and get the service name. If you need to see screenshots see the Windows command line example.

Step 2. Run Remote-Service PowerShell command.

Open PowerShell as administrator and run the below command. Replace servicename with the name found in Step 1.

Remove-Service -Name servicename

Note: I’m not sure why but the PowerShell command removed the service without requiring a reboot. The sc delete command required a reboot. It might depend on the service but just be aware you might need to reboot.

If you liked this post, you might also want to check out:

2 thoughts on “Delete a Windows Service with the Command Line or PowerShell”

  1. There is no Remove-Service in PS 5.1. This is a PS7 cmdlet and probably needs to be called out even though you clearly show a PS7 window.

    PS 5.1:
    Get-Command -Noun service

    CommandType Name Version Source
    ———– —- ——- ——
    Cmdlet Get-Service 3.1.0.0 Microsoft.PowerShell.Management
    Cmdlet New-Service 3.1.0.0 Microsoft.PowerShell.Management
    Cmdlet Restart-Service 3.1.0.0 Microsoft.PowerShell.Management
    Cmdlet Resume-Service 3.1.0.0 Microsoft.PowerShell.Management
    Cmdlet Set-Service 3.1.0.0 Microsoft.PowerShell.Management
    Cmdlet Start-Service 3.1.0.0 Microsoft.PowerShell.Management
    Cmdlet Stop-Service 3.1.0.0 Microsoft.PowerShell.Management
    Cmdlet Suspend-Service 3.1.0.0 Microsoft.PowerShell.Management

    PS7:
    Get-Command -Noun service

    CommandType Name Version Source
    ———– —- ——- ——
    Cmdlet Get-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet New-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet Remove-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet Restart-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet Resume-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet Set-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet Start-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet Stop-Service 7.0.0.0 Microsoft.PowerShell.Management
    Cmdlet Suspend-Service 7.0.0.0 Microsoft.PowerShell.Management

    Reply

Leave a Comment