Install windows service setup

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 media dvd проигрыватель совместимый dvd декодер

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

Читайте также:  Astra linux рутокен эцп

Установка с помощью 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.

Windows Setup Scenarios and Best Practices

WindowsВ Setup installs the Windows operating system. WindowsВ Setup uses a technology called Image-based Setup (IBS) that provides a single, unified process with which all customers can install Windows. IBS performs clean installations and upgrades of Windows and is used in both client and server installations. WindowsВ Setup also enables you to customize Windows during installation by using Setup answer file settings.

Common Usage Scenarios

Common installation scenarios include performing clean installations, upgrades, and unattended installations.

Custom Installations

The most common scenario for WindowsВ Setup is performing a custom installation. In this scenario, you install Windows onto a computer that does not have an operating system, or has a previous version of Windows. This scenario consists of the following stages:

Run Setup.exe from your Windows product DVD or network share.

Select the Custom installation type.

If you are installing from a previous installation of Windows, WindowsВ Setup creates a local boot directory and copies all of the required WindowsВ Setup files to this directory.

WindowsВ Setup reboots, installs and configures Windows components, and, after installation is complete, launches WindowsВ Welcome.

Custom installations do not migrate any settings or preferences from previously installed versions of Windows. Files from previous Windows versions are copied to a \Windows.old directory. All data from the Windows installation including the Users, Program Files, and Windows directories are saved to this directory.

Upgrades

WindowsВ Setup can also perform upgrades from a supported operating system.

This scenario includes the following stages:

Run Setup.exe on the previous version of Windows.

Select the Upgrade installation type. WindowsВ Setup upgrades the system and protects your files, settings, and preferences during the installation process.

WindowsВ Setup reboots and restores your protected files, settings, and preferences. WindowsВ Setup then launches WindowsВ Welcome.

NotesВ В

  • Upgrades are used to upgrade a single computer to WindowsВ 10.
  • Upgrades support migrating user data to a new system.
  • Upgrades support the following customizations of the Windows image. This is not a change in Windows Setup support policy but instead a clarification:
    • Applying a cumulative (quality) update
    • Applying updates to the servicing stack necessary to complete the feature update (see Servicing stack updates for more information)
    • Applying updates to Setup.exe binaries or other files that Setup uses for feature updates
    • Appling updates for the «safe operating system» (SafeOS) that is used for the Windows recovery environment
    • Adding or removing languages
    • Adding or removing Features on Demand

For clarity, Windows Setup does not support upgrades to a Windows image that has been customized by adding / removing / changing applications, settings nor drivers.

Automated Installations

Automated installations enable you to customize a Windows installation and remove the need for a user to interact with WindowsВ Setup. By using Windows System Image Manager (WindowsВ SIM) or the Component Platform Interface (CPI) APIs, you can create one or more customized Windows installations that can then be deployed across many different hardware configurations.

The automated installation, also called an unattended installation, scenario includes the following stages:

Use WindowsВ SIM or the CPI APIs to create an unattended installation answer file, typically called Unattend.xml. This answer file contains all of the settings that you configure in the Windows image. For more information, see Windows System Image Manager How-to Topics.

Читайте также:  Вылетают все приложения windows phone

From WindowsВ PE, a previous version of Windows, or another preinstallation environment, run Setup.exe with the explicit path to the answer file. If you do not include the path to the answer file, Setup.exe searches for a valid answer file in several specific locations. For more information, see Windows Setup Command-Line Options.

WindowsВ Setup then installs the operating system and configures all settings listed in the answer file. Additional applications, device drivers, and updates can also be installed during WindowsВ Setup. After the operating system is installed, Setup launches WindowsВ Welcome.

WindowsВ Setup Best Practices

The following section describes some of the best practices to use with WindowsВ Setup.

Verify that there is sufficient space for WindowsВ Setup temporary files. If you run setup from a previous version of Windows, verify that there is sufficient space on the disk for temporary WindowsВ Setup files. The space that is required may vary, but it can be up to 500В megabytes (MB).

Previous Windows installations are moved to a Windows.old folder. As a best practice, you should back up your data before you upgrade. If you install Windows over a previous Windows installation, all previous Windows files and directories are moved to a Windows.old folder, including the contents of the Users, Program Files, and Windows directories. You can access your data in the Windows.old folder after WindowsВ Setup completes. If you have additional folders not in the Users, Program Files, or Windows directories, those folders are not moved. For example, if you have a folder that is named C:\Drivers, that folder will not be moved to the Windows.old folder.

Review the Windows Setup log files. If you experience problems during WindowsВ Setup, review the log files in %WINDIR%\panther. You will be able to identify and troubleshoot many issues by reviewing the installation log files. For more information, see Deployment Troubleshooting and Log Files and Windows Setup Log Files and Event Logs.

WindowsВ Setup Limitations

The following sections describe some of the limitations of WindowsВ Setup. Review this section before you run WindowsВ Setup.

Enable UEFI-compatibility mode to install to an UEFI-based computer. On some UEFI computers, you cannot install Windows in BIOS-compatibility mode. You may need to switch to UEFI-compatibility mode.

Applications might require a consistent drive letter. If you install custom applications to your Windows image, install Windows to the same drive letter on the destination computer, because some applications require a consistent drive letter. Uninstallation, servicing, and repair scenarios might not function appropriately if the drive letter of the system does not match the drive letter specified in the application. This limitation applies to both the Deployment Image Servicing and Management (DISM) tool and WindowsВ Setup.

Deploying multiple images to multiple partitions. If you capture and deploy multiple images on multiple partitions, the following requirements must be fulfilled:

The partition structure, bus location, and number of disks must be identical on the reference and destination computers.

The partition types (primary, extended, or logical) must match. The active partition on the reference computer must match that of the destination computer.

Installing Custom .wim files requires a description value in the .wim file. When you create a custom .wim file, WindowsВ Setup requires that you always include a description value. If a .wim file does not include a description value, the image may not install correctly. You can provide a description value when you use the dism command with the /capture-image option. If you install a .wim file that does not have a description value, recapture the image and provide a valid description value. For more information, see the DISM — Deployment Image Servicing and Management Technical Reference for Windows.

NoteВ В For Windows Preinstallation Environment (WindowsВ PE), the version of boot files must match the computer architecture. An x64 UEFI computer can only boot by using WindowsВ PE x64 boot files. An x86 computer can only boot by using WindowsВ PE x86 boot files. This is different from legacy BIOS. In legacy BIOS, an x64 computer can boot by using x86 boot files.

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