How to Delete Windows Service from Command-Line and Registry

How to Delete Windows Service from Command-Line and Registry blog banner image

This tutorial provides step-by-step instructions on how to delete Windows service from command line or registry. These instructions work on both Windows 10 and Windows 11 and allow you to remove orphaned or unwanted services.

Overview of Windows services

Windows services are special programs that run in the background on your computer. They start with your system and provide functions that need to run continuously and don’t need your ongoing interaction. For example, antivirus runs a service in the background that continually monitors your files for viruses, as it needs to perform this task from the moment the computer starts and doesn’t need your input (if action needs to be taken, it can communicate with an associated desktop application that asks you to review its findings, install an update, etc.).

Services are different from standard applications in that they don’t have a direct interface and do not show up in the system tray or start bar, effectively hiding them from you during day-to-day use. Most services are part of Windows itself, providing sound, networking, and audio functionality, while others are added by third-party applications like third-party antivirus, firewalls, or file sharing and networking platforms.

You may want to delete a service on Windows because it is left over from an uninstalled application, or it is wasting resources. Uninstalling services must be done correctly to prevent your system from malfunctioning.

Precautions before deleting a Windows service

Before you perform any maintenance on your Windows PC, you should take a full backup of your system. If you’re deleting a service from the Windows registry, you should also take a registry backup.

You should also make sure you understand exactly which service you are deleting and its purpose to avoid accidentally removing the wrong service (and potentially something your system relies on to operate). You should at the very least search for the service name online before you delete it to make sure it isn’t something you need.

Deleting Windows Services via the Command Line

To delete a Windows service using the command line, follow these instructions:

  • Open the Services Manager console by right-clicking on the Start menu, clicking Run, and entering services.msc.
  • Find the service you want to delete in the list, and right-click on it. If Stop is not grayed out, click it to stop the service.
  • Make a note of the service name exactly as it is spelled in the Name column.
  • Right-click on the Start menu again, and click on Terminal (Admin), or Command Prompt (Admin) if you’re on Windows 10.
  • Enter the command sc delete SERVICENAME, replacing SERVICENAME with the exact name you recorded earlier.

Deleting Windows Services via the Command Line
This will delete the service from the configured Windows services. Once this is done, you can delete any files associated with the service.

To confirm that the service has been removed, you can press the refresh button in the Services Manager to check that it has been successfully deleted.

Deleting Windows services via registry editor

Attempting to delete a Windows service using the registry should be a last resort if the above method fails, as making a mistake when editing the registry risks damaging your Windows installation. As previously mentioned, make sure you take a backup before attempting these steps:

  • Right-click on the Start menu, click Run, and enter regedit.
  • Back up the registry by selecting Export from the File menu.
  • Follow the same process as in the previous Command Line steps to open the Services Manager console to find the name of the service you want to delete, and stop it if it is running.
  • Navigate to the Services key at the path: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices
  • Find the service you wish to delete by scrolling through the list of registry keys in the navigation tree in the left pane, and clicking on the folder icon next to the entry will display additional information.
  • In the left pane, right-click on the folder for the service you want to remove, and click Delete.
  • Confirm the deletion, and restart your computer.

The reboot step is necessary to reload the registry. Again, you can confirm that the service was successfully removed by checking the Services Management console.

Comparing the Command Line and registry methods

You should try to use the sc delete command from the command line whenever possible. This method is far safer as it reduces the chance of mistakenly deleting the wrong registry key and doesn’t require a restart. It also handles removing other configurations such as scheduled tasks and error logging, as well as any service accounts the process used.

Delete Windows service from command-line FAQ

Can I recover a deleted Windows service?

You cannot recover Windows service that has been uninstalled without re-installing the original application, or restoring from a system backup.

What happens if I delete a service that Windows needs?

If you delete a service that Windows relies on, your PC may not boot, or specific functionality related to the service may fail (for example, automatic updates will stop working if you disable the Windows Update service).

Are there third-party tools for deleting Windows services that are easier to use?

NSSM (Non-Sucking Service Manager) is a free and open-source tool for managing Windows services that includes functionality for deleting Windows service.

How do I clean up after removing a Windows service?

Using the sc delete command will clean up much of the configuration for a service, but files from the original application may still be left behind in your Program Files folder and other directories. You’ll need to find these yourself and manually remove them.

Windows service management best practices for organizations

If you want to make sure that only approved software is running on your fleet of Windows devices, endpoint management software by NinjaOne helps you remotely patch and manage your Windows machines, ensuring they are not harboring malware in their hidden services, and providing full visibility over your IT infrastructure and end-user devices.

Next Steps

For MSPs, their choice of RMM is critical to their business success. The core promise of an RMM is to deliver automation, efficiency, and scale so the MSP can grow profitably. NinjaOne has been rated the #1 RMM for 3+ years in a row because of our ability to deliver an a fast, easy-to-use, and powerful platform for MSPs of all sizes.
Learn more about NinjaOne, check out a live tour, or start your free trial of the NinjaOne platform.

You might also like

Ready to become an IT Ninja?

Learn how NinjaOne can help you simplify IT operations.

×

See NinjaOne in action!

By submitting this form, I accept NinjaOne's privacy policy.

Start your 14-day trial

No credit card required, full access to all features

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).