{"id":11098,"date":"2025-10-20T17:00:50","date_gmt":"2025-10-20T17:00:50","guid":{"rendered":"https:\/\/cheapwindowsvps.com\/blog\/effortlessly-delete-a-windows-service-using-cmd-or-powershell-a-step-by-step-guide\/"},"modified":"2025-10-20T17:00:50","modified_gmt":"2025-10-20T17:00:50","slug":"effortlessly-delete-a-windows-service-using-cmd-or-powershell-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/cheapwindowsvps.com\/blog\/effortlessly-delete-a-windows-service-using-cmd-or-powershell-a-step-by-step-guide\/","title":{"rendered":"Effortlessly Delete a Windows Service Using CMD or PowerShell: A Step-by-Step Guide"},"content":{"rendered":"<p>After uninstalling certain programs, it\u2019s not uncommon for leftover services to remain in Windows. This guide will explain how to properly delete a service using the built-in CMD or PowerShell tools, as the Services console (<code>services.msc<\/code>) only allows basic operations like starting, pausing, or stopping services, but not removing them.<\/p>\n<h3>Steps to Delete a Windows Service<\/h3>\n<ol>\n<li>\n<p><strong>Identify the Service<\/strong>:To remove a service, you must know its name. For example, if you&#8217;re removing the Stunnel TLS wrapper service, the service name is <strong>stunnel<\/strong>. You can find this name in the Service&#8217;s properties.<\/p>\n<\/li>\n<li>\n<p><strong>Disable the Service<\/strong> (Optional but Recommended):Before deletion, it\u2019s prudent to disable the service and observe its behavior. You can disable it with the following PowerShell command:<\/p>\n<pre><code class=\"language-powershell\">Set-Service stunnel \u2013Startuptype Disabled \u2013PassThruStop-Service stunnel<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Stop the Service<\/strong>:You need to stop the service before deletion. This can be done through the Services console or with the command:<\/p>\n<pre><code class=\"language-cmd\">net stop stunnel<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Back Up Service Configuration<\/strong>:It&#8217;s wise to back up service settings which are stored in the registry. You can export the service configuration to a REG file with:<\/p>\n<pre><code class=\"language-cmd\">reg export &quot;HKLMSYSTEMCurrentControlSetServicesstunnel&quot; &quot;%HOMEPATH%Documentsstunnel_backup.reg&quot; \/y<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Remove the Service<\/strong>:You can delete the service using the <code>sc.exe<\/code> command:<\/p>\n<pre><code class=\"language-cmd\">sc delete stunnel<\/code><\/pre>\n<p>If successful, you should receive a message indicating the service was deleted.<\/p>\n<\/li>\n<li>\n<p><strong>Using PowerShell to Remove the Service<\/strong>:If you&#8217;re using PowerShell Core version 6.x or newer, you can directly remove a service with:<\/p>\n<pre><code class=\"language-powershell\">Remove-Service stunnel<\/code><\/pre>\n<p>For Windows PowerShell 5.1, use WMI:<\/p>\n<pre><code class=\"language-powershell\">$service = Get-WmiObject -Class Win32_Service -Filter &quot;Name='stunnel'&quot;$service.Delete()<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Deleting Registry Entry (Advanced Method)<\/strong>:As a last resort, you can manually delete the service registry key. Ensure the target service is correct by checking if the <strong>DisplayName<\/strong> and <strong>ImagePath<\/strong> in the registry match the service you&#8217;re intending to delete. Delete the entire service key from:<\/p>\n<pre><code>HKLMSYSTEMCurrentControlSetServices<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Refreshing the Services Console<\/strong>:After completion, press <code>F5<\/code> in the Services console to verify that the service has been removed. A system restart may be necessary for changes to take full effect.<\/p>\n<\/li>\n<\/ol>\n<h3>Additional Notes<\/h3>\n<p>When attempting to delete some services via CMD, you might see a message indicating that the service is marked for deletion, which typically means it\u2019s queued for removal but may require a restart to finalize the process. Alternatively, you can use the <code>taskkill<\/code> command or terminate the process from the Task Manager before deleting the service registry key.<\/p>\n<p>For further guidance on accessing and managing services, you may refer to related articles on <a target=\"_blank\" rel=\"nofollow noopener\" href=\"https:\/\/woshub.com\/install-update-powershell-windows\/\">removing services in PowerShell<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After uninstalling certain programs, it\u2019s not uncommon for leftover services to remain in Windows. This guide will explain how to properly delete a service using the built-in CMD or PowerShell tools, as the Services console (services.msc) only allows basic operations like starting, pausing, or stopping services, but not removing them. Steps to Delete a Windows [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":11099,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98,99],"tags":[],"class_list":["post-11098","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-10","category-windows-11"],"_links":{"self":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/11098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/comments?post=11098"}],"version-history":[{"count":0,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/11098\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/media\/11099"}],"wp:attachment":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/media?parent=11098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/categories?post=11098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/tags?post=11098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}