Remove installed windows service

How to: Install and uninstall Windows services

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. 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. 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. Note that many services are integral parts of Windows; if you remove them, you might cause system instability.

To use the steps in this article, you first need to add a service installer to your Windows service. For more information, see Walkthrough: Creating a Windows service app.

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.

Install using InstallUtil.exe utility

From the Start menu, select the Visual Studio directory, then select Developer Command Prompt for VS .

The Developer Command Prompt for Visual Studio appears.

Access the directory where your project’s compiled executable file is located.

Run InstallUtil.exe from the command prompt with your project’s executable as a parameter:

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. This tool is installed with the .NET Framework in %WINDIR%\Microsoft.NET\Framework[64]\ .

  • 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.
  • 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.

Uninstall using InstallUtil.exe utility

From the Start menu, select the Visual Studio directory, then select Developer Command Prompt for VS .

The Developer Command Prompt for Visual Studio appears.

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. If that’s the case, use the command sc delete to remove the entry for the service from the registry.

Install using 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.

Run the New-Service cmdlet with the with your project’s output and a service name as parameters:

Uninstall using PowerShell

From the Start menu, select the Windows PowerShell directory, then select Windows PowerShell.

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. If that’s the case, use the command sc delete to remove the entry for the service from the registry.

Практическое руководство. Установка и удаление служб 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).

Читайте также:  Как изменить разметку жесткого диска windows 10

Если вы хотите удалить службу на своем компьютере, не выполняйте процедуру, описанную в этой статье. 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.

Удаление с помощью служебной программы 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:

Читайте также:  Почему у меня не скачивается windows 10

После удаления исполняемого файла для службы сама служба может по-прежнему присутствовать в реестре. 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.

Как удалить службу Windows в Windows 7, 8, 10, Vista или XP

Если Вы поклонник настройки Вашей системы и отключения служб, то Вы можете обнаружить, что со временем список служб Windows станет большим и громоздким. Достаточно просто удалить службу Windows с помощью командной строки.

Однако, мы должны предупредить. После удаления службы ее достаточно сложно будет вернуть (если вдруг это понадобится). Мы не рекомендуем удалять службы вообще, если только Вы не сталкиваетесь с такой ситуацией, как очистка после того, как программа была удалена ненадлежащим образом или изменена зараженными вредоносными программами. Как правило, просто отключить службу достаточно, особенно если все, что Вы действительно пытаетесь сделать, это настроить производительность Вашей системы (что, вероятно, не будет работать так же хорошо, как Вы могли бы надеяться). При этом, если Вам нужно удалить службу, Вам просто нужно найти фактическое имя этой службы, а затем запустить одну команду из командной строки.

Методы, которые мы рассмотрим здесь, должны работать практически в любой версии Windows — от XP до 10.

Шаг первый: найдите имя службы, которую хотите удалить

Первое, что вам нужно сделать, это определить полное имя службы, которую вы хотите удалить. В нашем примере мы используем службу демонстрации магазина — любопытная вещь, которая активирует скрытую команду для переключения Windows в режим розничной продажи (и в стирает все личные документы и сбрасывает Ваш компьютер до состояния по умолчанию), поэтому на самом деле это хороший пример службы, которой Вы, возможно, не захотите оставлять.

Нажмите «Пуск», введите «службы» в поле поиска и нажмите результат поиска.

В окне «Службы» прокрутите страницу вниз и найдите службу, которая больше не нужна. Нажмите правой кнопкой мыши на службу и выберите «Свойства».

How To Remove Services In Windows

Services in the Windows operating system are background processes that usually require no user interaction. They are automatically started with Windows, or when a certain event occurs that triggers them. Most system administrators distinguish between first party and third party services. First party services have been installed with the operating system, they are from Microsoft and many are core parts of the OS. Disabling a core service could have serious consequences; Windows may stop booting, Internet may not work anymore or the printer refuses to print.

Third party services on the other hand are added by third party developers like Google, Apple or the company that developed the antivirus software that you have installed on the system.

These services sometimes cause problems, for instance if they are still listed under services even if the application has been long removed from the copy of Windows. Malicious software may add services as well sometimes and it may be necessary to delete them when your antivirus software is not able to.

But how can you remove services from Windows? The following guide highlights three different options; A command line tool, the Windows Registry and a third party software.

Removing Services from the command line

This is probably the most complex solution. You may need to open an elevated command prompt first, depending on the version of Windows. You can try and open the command line normally with the hotkey Windows-r, typing cmd and pressing enter. If you issue the command and get an error that you need administrative privileges you need to click on the Windows start orb, select Programs (or All Programs), then Accessories. Locate Command Prompt, right-click the item in the start menu and select Run as Administrator from the context menu. This triggers an UAC prompt under Vista and Windows 7 that needs to be accepted.

The command prompt displays Administrator: Command Prompt if the operation was successful.

Windows 7 and Vista users who have the search box enabled in the start menu can enter cmd instead in the box to open the elevated command prompt with Ctrl-Shift-Enter.

Windows Services are deleted with the command sc delete followed by the name of the service. Since it is likely that you do not know the name you need to open the Windows Services listing. This is done with the keys Windows-r, typing services.msc and enter on the keyboard.

What you need is the service name, not the display name that is shown in the main listing. The names may be identical sometimes. Double-click the service that you want to delete to see both names. Apple Mobile Device is for instance the service name and display name of the service. Microsoft on the other hand often uses short cryptic service names and longer display names. The Bitlocker Drive Encryption Service (display name) is listed with the service name BDESVC.

Читайте также:  При загрузке windows потом нет сигнала

The name may have implications on the command. Lets say we want to delete the Apple Mobile Device service, a leftover after uninstalling iTunes. The command to do that on the command line is sc delete «Apple Mobile Device».

Notice the quotation marks around the service’s name? A space is generally seen as a new command or parameter, which means that it is necessary to use quotation marks if names or commands make use of spaces to basically tell the program that they are all part of a word or phrase. Take a look at the screenshot below to see what happens if the command is issued without quotation marks, and then with.

To paraphrase: To delete services from the command line you need to do the following:

  • Open an elevated command prompt
  • Open the Windows Services management listing
  • Identify the service name and not the display name by double-clicking on a service.
  • Run the command, make sure you use quotation marks if the name contains spaces.
  • The message [SC] DeleteService SUCCESS indicates that the service has been successfully removed from the operating system.

Deleting Services in the Windows Registry

All services are listed in the Windows Registry. If a service’s Registry key is removed, it will be deleted from the system. This method is a lot faster usually. Here is how it is done:

Use the hotkey Windows-r to open a run box, enter regedit in the box and press enter. Some users may see an UAC prompt that they need to accept.

The window displays folders on the left side, and subfolders or parameters on the right. Locate the following Registry key by following the folder structure on the left.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services

A click on services lists all available Windows Services as subfolders of that key. Please note that the service’s Service Name is used as the folder name which means that you may need to open the Services listing once again to identify the right services.

I suggest you backup the key first before you start deleting services. Left-click on the services folder and select File > Export to backup the key. Type in a file name and save it to the hard drive.

You can import the backed up key again by selecting File > Import and the file that you have previously exported.

Locate the service that you want to delete in the listing. A left-click selects the service and displays its parameters on the right pane. To remove a service press delete on the keyboard, or right-click the service and select delete from the context menu.

To paraphrase this method:

  • Open the Windows Registry
  • Navigate to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services
  • Backup the services key
  • Identify the service that you want to delete
  • Left-click on that service and press delete on the keyboard

Using Third Party Software To Remove Windows Services

This method is probably the easiest from them all. All you need to do is to download the popular software Autoruns, which is freely available from Microsoft. The program is portable which means that it does not need to be installed after unpacking. Run autoruns.exe.

The program lists everything that gets started during Windows start. Locate the Services tab at the top and click it. All first and third party services are listed here by default.

You may want to filter out Microsoft services if you want to delete a third party service. Click on Options > Hide Microsoft and Windows Entries and press F5 afterwards to refresh the listing.

Locate the service that you want to delete and select it with a left-click. Press delete on the keyboard and confirm the deletion in the Windows that opens. Some Windows users may receive an access denied message. That’s when the software is not run with elevated privileges. Just select Run as Administrator to restart Autoruns with administrative privileges and accept the UAC prompt if it is displayed.

Perform the removal operation again, this time it should work. The entry is removed from the services listing immediately on success.

To summarize this method:

  • Download the free software Autoruns from Microsoft
  • Switch to the services tabs
  • Locate the service you want to delete
  • Left-click the service, press delete and confirm the deletion

Closing Words

This three methods should be enough to delete services in the Windows operating system. Autoruns is without doubt the most comfortable solution, the other two methods are on the other hand «built-in» which has its advantages as well.

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