How to remove the service in windows

Практическое руководство. Установка и удаление служб Windows How to: Install and uninstall Windows services

Если вы разрабатываете службу Windows с помощью .NET Framework, вы можете быстро установить приложение службы с помощью служебной программы командной строки InstallUtil.exe или PowerShell. If you’re developing a Windows service with the .NET Framework, you can quickly install your service app by using the InstallUtil.exe command-line utility or PowerShell. Если вы являетесь разработчиком и хотите создать службу Windows, которую пользователи могут устанавливать и удалять, можно использовать набор инструментов WiX или коммерческие средства, такие как Advanced Installer, InstallShield или другие. Developers who want to release a Windows service that users can install and uninstall can use the free WiX Toolset or commercial tools like Advanced Installer, InstallShield, or others. См. сведения о создании пакета установщика (классическое приложение Windows). For more information, see Create an installer package (Windows desktop).

Если вы хотите удалить службу на своем компьютере, не выполняйте процедуру, описанную в этой статье. If you want to uninstall a service from your computer, don’t follow the steps in this article. Вместо этого определите, какая программа (или программный пакет) установила эту службу, а затем выберите Приложения в параметрах, чтобы удалить эту программу. Instead, find out which program or software package installed the service, and then choose Apps in Settings to uninstall that program. Следует отметить, что многие службы являются составной частью ОС Windows. Если их удалить, это может привести к нестабильной работе системы. Note that many services are integral parts of Windows; if you remove them, you might cause system instability.

Чтобы использовать процедуру, описанную в этой статье, сначала необходимо добавить установщик службы в свою службу Windows. To use the steps in this article, you first need to add a service installer to your Windows service. Дополнительные сведения см. в разделе Пошаговое руководство: создание диспетчера служб Windows. For more information, see Walkthrough: Creating a Windows service app.

Проекты служб Windows нельзя запускать непосредственно из среды разработки Visual Studio путем нажатия клавиши F5. You can’t run Windows service projects directly from the Visual Studio development environment by pressing F5. Перед запуском проекта необходимо установить службу в проекте. Before you can run the project, you must install the service in the project.

Запустите обозреватель сервера и убедитесь, что служба установлена или удалена. You can use Server Explorer to verify that you’ve installed or uninstalled your service.

Установка с помощью программы InstallUtil.exe Install using InstallUtil.exe utility

В меню Пуск выберите каталог Visual Studio и затем Командная строка разработчика для VS . From the Start menu, select the Visual Studio directory, then select Developer Command Prompt for VS .

Появится командная строка разработчика для Visual Studio. The Developer Command Prompt for Visual Studio appears.

Откройте каталог, где находится скомпилированный исполняемый файл вашего проекта. Access the directory where your project’s compiled executable file is located.

Запустите InstallUtil.exe из командной строки, указав исполняемый файл проекта в качестве параметра: Run InstallUtil.exe from the command prompt with your project’s executable as a parameter:

Если вы используете командную строку разработчика для Visual Studio, системный путь должен указывать на файл InstallUtil.exe. If you’re using the Developer Command Prompt for Visual Studio, InstallUtil.exe should be on the system path. Если это не так, можно добавить его в путь или использовать полный путь для его вызова. Otherwise, you can add it to the path, or use the fully qualified path to invoke it. Этот инструмент устанавливается вместе с платформой .NET Framework в папку %WINDIR%\Microsoft.NET\Framework[64]\ . This tool is installed with the .NET Framework in %WINDIR%\Microsoft.NET\Framework[64]\ .

Пример: For example:

  • Для 32-разрядной версии .NET Framework 4 или 4.5 и более поздних версий: если каталог установки Windows — C:\Windows, по умолчанию используется путь C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe. For the 32-bit version of the .NET Framework 4 or 4.5 and later, if your Windows installation directory is C:\Windows, the default path is C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe.
  • Для 64-разрядной версии .NET Framework 4 или 4.5 и более поздних версий: по умолчанию используется путь C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe. For the 64-bit version of the .NET Framework 4 or 4.5 and later, the default path is C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe.
Читайте также:  Linux приложения под android

Удаление с помощью служебной программы InstallUtil.exe Uninstall using InstallUtil.exe utility

В меню Пуск выберите каталог Visual Studio и затем Командная строка разработчика для VS . From the Start menu, select the Visual Studio directory, then select Developer Command Prompt for VS .

Появится командная строка разработчика для Visual Studio. The Developer Command Prompt for Visual Studio appears.

Запустите InstallUtil.exe из командной строки, указав выходные данные проекта в качестве параметра: Run InstallUtil.exe from the command prompt with your project’s output as a parameter:

После удаления исполняемого файла для службы сама служба может по-прежнему присутствовать в реестре. After the executable for a service is deleted, the service might still be present in the registry. В этом случае удалить запись службы из реестра можно с помощью команды sc delete. If that’s the case, use the command sc delete to remove the entry for the service from the registry.

Установка с помощью PowerShell Install using PowerShell

В меню Пуск выберите Каталог Windows PowerShell и Windows PowerShell. From the Start menu, select the Windows PowerShell directory, then select Windows PowerShell.

Откройте каталог, где находится скомпилированный исполняемый файл вашего проекта. Access the directory where your project’s compiled executable file is located.

Выполните командлет New-Service, указав в качестве параметров выходные данные проекта и имя службы. Run the New-Service cmdlet with the with your project’s output and a service name as parameters:

Удаление с помощью PowerShell Uninstall using PowerShell

В меню Пуск выберите Каталог Windows PowerShell и Windows PowerShell. From the Start menu, select the Windows PowerShell directory, then select Windows PowerShell.

Выполните командлет Remove-Service, указав в качестве параметра имя службы. Run the Remove-Service cmdlet with the name of your service as parameter:

После удаления исполняемого файла для службы сама служба может по-прежнему присутствовать в реестре. After the executable for a service is deleted, the service might still be present in the registry. В этом случае удалить запись службы из реестра можно с помощью команды sc delete. If that’s the case, use the command sc delete to remove the entry for the service from the registry.

How to Remove Services in Windows 10

By Mitch Bartlett 11 Comments

Remove services from the list in the services.msc utility in Microsoft Windows with one of these two options.

Option 1 – Command

  1. You can also remove services using a command line. Hold down the Windows Key, then press “R” to bring up the Run dialog.
  2. Type “SC DELETE servicename“, then press “Enter“.

“servicename” should be the exact name of the service.

Option 2 – Registry

  1. Hold down the Windows Key and press “R“.
  2. Type “regedit“, then select “OK“.
  3. Navigate to the following location in the registry:
    • HKEY_LOCAL_MACHINE
    • System
    • CurrentControlSet
    • Services
  4. There are folders under “Services” that contain each service. The “DisplayName” values in each of these folders equals the Service Name. Go through the list or use the “Edit” > “Find” menu to search for the service you wish to remove.
Читайте также:  Как запустить службу smart card windows 10

These steps only delete the name of the service. How do I delete the actual program that is running as a service?

You can track it down with these steps:

  1. Right-click the taskbar and choose “Task Manager“.
  2. Select the “Services” tab.
  3. Right-click the service you wish to delete, then choose “Go to details“.
  4. The process related to the service is highlighted. If you wish to remove it, you can track it down by right-clicking it and selecting “Open file location“. From there, either uninstall the related program from “Add/Remove Programs” or delete the EXE file as desired.

You Might Also Like

Filed Under: Windows Tagged With: Windows 10

Reader Interactions

Comments

Rishu kumar dubey says

nothing worked for me as above
for me, the solution was
1. Get the service name, services.msc or taskmanager > services may be the point from where to get the servicename.
2. Open command prompt as admin
3. Use the command: SC DELETE “ServiceName”
4. Press Enter or Ok

Now can check if it is deleted or not with below

All data system services delete and cancel network sharing information system services all media reports that and application data all delete and cancel all like and comment and post and sharing information data all covid 19 and cancel delete

Surjit Dadhwal says

SC DELETE ServiceName did not worked for me. Few points that might be helpful:
1) Use double quotes around ServiceName. So SC DELETE “ServiceName”
2) If 1 does not work then use .exe with SC. So SC.exe DELETE “ServiceName”

Number 2 worked for me.

Maybe take a look here if you are stuck with deleting the service:

Juho Leiniö says

Thanks a ton! The option 1 worked for me.

Thanks! it works for me!

Command –> SC DELETE “ServiceName” binPath= “C:\Program Files (x86)\XXX\ServiceName.exe -c Service.config”

Run the command prompt as administrator:
click start -> search for cmd -> right click -> choose “run as administrator
then run the command in step 1, this worked for me on windows 10

2 one worked.Thanks a lot.

Larry Kavounas says

Friends, this is very helpful! I learned a lot!
Can you please finish the option #2:

Once I find the entry in the registry, what do I do?
I imagine right-mouse-click on the yellow folder and delete?
can you please confirm?
Thanks
Larry

no , i tried both tricks, and both failed.
I first tried the RUN command, and nothing happened, the services were still being shown up on Service Applet listing.
Then i tried the registry trick, but still the service is still being shown on the services applet list., although this time the description given in the services list applet has changed to “Failed to load description. Error code 2”
With the registry trick only its description is lost, service is still on the list
(NB: i have stopped the services before trying these tricks)

Did this help? Let us know! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

How to Delete a Service in Windows using Different Methods

Have you come across a situation where uninstalling a software leaves its Service or driver entries in the registry, and Windows tries to load them at every boot, fails, and logs the error to the System Event log at every startup?

This article tells you how to delete an orphaned service in Windows 10 (and earlier) using the registry, SC.exe command-line, PowerShell, or Autoruns. Before proceeding further, create a System Restore Point and/or a complete Registry backup.

If you find that no dependents exist for a service, you can proceed to delete the leftover or unwanted Service in Windows using one of the following methods.

How to Delete a Service in Windows?

You can delete a service using the built-in SC.exe command-line, the Registry Editor, PowerShell, or a utility like Autoruns. Follow one of these methods:

Читайте также:  Как узнать свободные com порты windows

Delete a Service Using the SC command

The SC.EXE command-line tool in Windows can be used to create, edit, or delete Services. To delete a service in Windows, use the following command-line syntax from admin Command Prompt:

Another way to find the short name of a service is by using this command-line:

which in this example is:

Once the service short name is obtained using any of the above methods, use this command to delete the Service:

You’ll see the output: [SC] DeleteService SUCCESS

This deletes the specified service (“test” service in this example) from the computer.

If the service is running or another process has an open handle to the service, it will be marked for deletion and removed on the next reboot.

Can’t delete a service?

If you receive the following error when deleting the service, it could also be possible that you’re trying to delete a service from a normal Command Prompt, instead of an elevated or admin Command Prompt.

Should the same error occur in an admin Command Prompt, then it means that the currently logged on user account doesn’t have full control permissions for that service.

To resolve this error when deleting a service, you need to modify the Service permissions first. Alternatively, you can use the SYSTEM or TrustedInstaller account to delete the service.

Delete a Service Using Autoruns from Windows Sysinternals

Autoruns, from Microsoft Windows Sysinternals, is a must-have tool that helps you manage Windows startup, services, drivers, Winsock providers, Internet Explorer add-ons, Shell extensions, etc.

  1. Download Autoruns and run it
  2. From the Options tab, tick Hide Microsoft Entries so that only the third-party entries are listed.
  3. Press F5 to refresh the listing.
  4. Click the Services tab to delete the service(s) that are unwanted or leftover.
  5. Close Autoruns.

Delete a Service Using the Registry Editor

To manually delete a service directly via the Windows Registry, use these steps:

  1. Start Regedit.exe and navigate to the following branch: Services registry key.

Each sub-key under the above registry key represents a driver or a Service. The key name is also the short name of the service. Also, you should be able to identify the entry easily by looking at the DisplayName and ImagePath values in the right pane in the Registry Editor.

  • Find the entry you want to delete.
  • Backup the appropriate key by exporting it to a .reg file.
  • Once exported, right-click the key, and choose Delete.
  • Exit the Registry Editor.
  • Delete a Service Using PowerShell

    From the PowerShell administrator window, you can use the following commands to delete a service.

    ReturnValue of 0 indicates that the operation was successful. The service is deleted and will no longer show up in the Services MMC.

    To know the meaning for a return value, check out the Microsoft article Delete method of the Win32_Service class

    It’s even easier if you have PowerShell 6.0 installed. In PowerShell 6 and higher, you can use this syntax to remove a service:

    Running the Remove-Service command in older versions of PowerShell ( ID:7000 at every start.

    So, it’s advisable to first check if there are any dependents. You can check that in Services MMC by double-clicking on the item you’re going to delete and clicking the Dependencies tab. The list of components that depend on that service is shown below. Here is an example, where “Fax” depends on “Print Spooler” to start.

    While most third-party services don’t have any dependents, some do. It’s always advisable to take a look at this tab before clearing the item.

    Another way to verify the dependents is to run this command from a Command Prompt window. (example, Print Spooler)

    The information in this article applies to all versions of Windows, including Windows 10.

    Оцените статью