How to FIX 'SC OpenService FAILED 5: Access is denied' Error (Solved)
If you're trying to delete a service from the command prompt using the sc delete command and encounter the error "[SC] OpenService FAILED 5: Access is denied" this guide provides detailed solutions to resolve the issue effectively.
The error "[SC] OpenService FAILED 5: Access is denied" typically arises when a user lacks the necessary permissions to delete a Windows service. Even with appropriate permissions, the error may occur if the service is corrupted or if special permissions inhibit its deletion.
How to Fix: "SC OpenService FAILED 5: Access is Denied" Error in "SC DELETE" Command
* Important: Before proceeding with the methods below, ensure that:
- You are logged into Windows with a user who has administrator rights. Administrator rights are essential for modifying system services, as they provide the necessary permissions to alter system-level configurations.
- You execute the "sc delete" command in an administrator command prompt. Running the command prompt as an administrator ensures that the command has the elevated privileges needed to modify or delete services.
- The service you're attempting to delete is not running. To stop a service from the command prompt, use one of these commands:
sc stop "service name"net stop "service name"
Stopping the service is crucial as it releases any active processes or locks that might prevent the deletion.
Method 1. Delete Service from Registry
The first method to resolve the error "[SC] OpenService FAILED 5: Access is denied" is to remove the service directly from the Windows Registry:
1. Press the Windows
+ R keys to open the Run command box.
2. Type regedit and press Enter to open the Registry Editor. The Registry Editor allows you to view and modify the registry keys and values that define how your system operates.
3. In Registry Editor, navigate to this location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
* This path contains all the services configurations for your system.
4. Under the "Services" key, locate the service that you cannot delete from the command prompt.
5. Right-click on the service and choose Delete. Then click Yes to confirm. Deleting the service key removes its configuration from the system registry, effectively uninstalling it.
* Note: If you receive an error when deleting the service, follow the instructions in Method 2 below.
6. Close the Registry Editor and reboot the machine to apply the change. Rebooting ensures that the service is completely removed from the system's active configuration.
Method 2. Delete Service using Autoruns
The second method to delete a service that shows the error "SC OpenService FAILED 5: Access is denied" when using the "sc delete" command is by using Autoruns.
Autoruns is a utility developed by Sysinternals, now part of Microsoft, that allows users to view and manage the programs, processes, services, and drivers that automatically start with Windows. It provides a comprehensive view of all auto-starting locations of any startup monitor.
1. Download Autoruns and Autorunsc from Microsoft's official site.
2. Once the download is complete, extract the downloaded Autoruns.zip file to a folder.
3. Explore the folder's contents, right-click on Autoruns64.exe and choose Run as administrator. Running as an administrator is necessary to gain full access to the system's startup configurations.
* Note: If you have a 32-bit Windows, right-click on Autoruns.exe.
4. In 'Autoruns', select the Services tab, right-click on the service you want, and select Delete to remove it. This action removes the service from the list of auto-start entries, effectively disabling it.
5. Restart your PC to finalize the changes. Restarting ensures that the service is completely removed from the system's startup configuration.
Additional Method: Use PowerShell to Remove Service
Another effective method to remove a service is by using PowerShell, which provides a powerful scripting environment for automating administrative tasks:
- Open PowerShell as an administrator by searching for "PowerShell" in the Start menu, right-clicking on it, and selecting Run as administrator.
- Use the following command to remove the service:
Remove-Service -Name "service name"This command directly removes the service from the system, bypassing any GUI limitations.
- Restart your computer to ensure the service is fully removed.
Summary
In summary, the error "[SC] OpenService FAILED 5: Access is denied" can be resolved by ensuring proper administrative privileges, stopping the service before deletion, and using tools like the Registry Editor, Autoruns, or PowerShell. Each method provides a different approach to removing stubborn services, ensuring that users can maintain their system's health and performance.
We hope these solutions have been helpful. Please leave a comment below if you have any questions or share this guide to help others facing similar issues.
Frequently Asked Questions
What causes the "[SC] OpenService FAILED 5: Access is denied" error when using the "sc delete" command?
The error typically occurs because the user does not have the required permissions to delete the service. In some cases, the error may also pop up due to a corrupted service or special permissions preventing the deletion.
What should I verify before trying to delete a service using the command prompt?
Ensure that you are logged in as a user with administrative rights, run the "sc delete" command in an administrator command prompt, and confirm that the service you're attempting to delete is not actively running.
How do I delete a service using the Windows Registry?
Use the Run command box to open the Registry Editor by typing "regedit". Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services, locate the service you want to delete, right-click it and select Delete. Confirm the deletion and reboot your machine to apply the changes.
How can I remove a service using Autoruns if I encounter access denied issues?
Download Autoruns from the Microsoft Sysinternals website, extract the file, and run Autoruns as an administrator. Go to the Services tab, right-click the service you wish to remove, and select Delete. Restart your PC to complete the process.
