- sc.exe удалить sc.exe delete
- Синтаксис Syntax
- Параметры Parameters
- Примеры Examples
- Практическое руководство. Установка и удаление служб Windows How to: Install and uninstall Windows services
- Установка с помощью программы InstallUtil.exe Install using InstallUtil.exe utility
- Удаление с помощью служебной программы InstallUtil.exe Uninstall using InstallUtil.exe utility
- Установка с помощью PowerShell Install using PowerShell
- Удаление с помощью PowerShell Uninstall using PowerShell
- Установка и удаление ролей, служб ролей и компонентов Install or Uninstall Roles, Role Services, or Features
- Установка ролей, служб ролей и компонентов с помощью мастера добавления ролей и компонентов Install roles, role services, and features by using the add Roles and Features Wizard
- Установка ролей и компонентов с помощью мастера добавления ролей и компонентов To install roles and features by using the add Roles and Features Wizard
- Установка ролей, служб ролей и компонентов при помощи командлетов Windows PowerShell Install roles, role services, and features by using Windows PowerShell cmdlets
- Установка ролей и компонентов при помощи командлета Install-WindowsFeature To install roles and features by using the Install-WindowsFeature cmdlet
- Удаление ролей, служб ролей и компонентов с помощью мастера удаления ролей и компонентов Remove roles, role services, and features by using the remove Roles and Features Wizard
- Удаление ролей и компонентов с помощью мастера удаления ролей и компонентов To remove roles and features by using the remove Roles and Features Wizard
- Удаление ролей, служб ролей и компонентов при помощи командлетов Windows PowerShell Remove roles, role services, and features by using Windows PowerShell cmdlets
- Удаление ролей и компонентов при помощи командлета Uninstall-WindowsFeature To remove roles and features by using the Uninstall-WindowsFeature cmdlet
- Установка ролей и компонентов на нескольких серверах при помощи сценария Windows PowerShell Install roles and features on multiple servers by running a Windows PowerShell script
- Установка ролей и компонентов на нескольких серверах To install roles and features on multiple servers
- Установка по требованию .NET Framework 3.5 и других компонентов Install .NET Framework 3.5 and other features on-demand
- Порядок установки .NET Framework 3.5 с помощью командлета Install-WindowsFeature To install .NET Framework 3.5 by running the Install-WindowsFeature cmdlet
- Установка платформа .NET Framework 3,5 с помощью мастера добавления ролей и компонентов To install .NET Framework 3.5 by using the add Roles and Features Wizard
- Установка .NET Framework 3.5 с помощью DISM To install .NET Framework 3.5 by using DISM
- Настройка альтернативных источников файлов компонентов в групповой политике Configure alternate sources for feature files in Group Policy
sc.exe удалить sc.exe delete
Удаляет подраздел службы из реестра. Deletes a service subkey from the registry. Если служба запущена или другой процесс имеет открытый обработчик, служба помечается для удаления. If the service is running or if another process has an open handle to the service, the service is marked for deletion.
Мы не рекомендуем использовать эту команду для удаления встроенных служб операционной системы, таких как DHCP, DNS или службы IIS. We don’t recommend you to use this command to delete built-in operating system services such as DHCP, DNS, or Internet Information Services. Сведения об установке, удалении и перенастройке ролей операционной системы, служб и компонентов см. в разделе Установка и удаление ролей, служб ролей или компонентов . To install, remove, or reconfigure operating system roles, services and components, see Install or Uninstall Roles, Role Services, or Features
Синтаксис Syntax
Параметры Parameters
Параметр Parameter | Описание Description |
---|---|
Указывает имя удаленного сервера, на котором расположена служба. Specifies the name of the remote server on which the service is located. Имя должно использовать формат UNC (например, \ MyServer). The name must use the Universal Naming Convention (UNC) format (for example, \myserver). Чтобы запустить SC.exe локально, не используйте этот параметр. To run SC.exe locally, don’t use this parameter. | |
Указывает имя службы, возвращенное операцией жеткэйнаме . Specifies the service name returned by the getkeyname operation. | |
/? /? | Отображение справки в командной строке. Displays help at the command prompt. |
Примеры Examples
Чтобы удалить подраздел Service невсерв из реестра на локальном компьютере, введите: To delete the service subkey NewServ from the registry on the local computer, type:
Практическое руководство. Установка и удаление служб 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.
Удаление с помощью служебной программы 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.
Установка и удаление ролей, служб ролей и компонентов Install or Uninstall Roles, Role Services, or Features
Область применения. Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012 Applies To: Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012
В Windows Server консоль диспетчер сервера и командлеты Windows PowerShell для диспетчер сервера позволяют устанавливать роли и компоненты на локальные или удаленные серверы или в автономные виртуальные жесткие диски (VHD). In Windows Server, the Server Manager console and Windows PowerShell cmdlets for Server Manager allow installation of roles and features to local or remote servers, or offline virtual hard disks (VHDs). Вы можете установить несколько ролей и компонентов на одном удаленном сервере или в автономном виртуальном жестком диске в мастере добавления ролей и компонентов или в сеансе Windows PowerShell. You can install multiple roles and features on a single remote server or offline VHD in a single add Roles and Features Wizard or Windows PowerShell session.
Диспетчер серверов нельзя использовать для управления более новыми выпусками операционной системы Windows Server. Server Manager cannot be used to manage a newer release of the Windows Server operating system. Диспетчер сервера, выполняющиеся в Windows Server 2012 R2 или Windows 8.1, нельзя использовать для установки ролей, служб ролей и компонентов на серверах под Windows Server 2016. Server Manager running on Windows Server 2012 R2 or Windows 8.1 cannot be used to install roles, role services, and features on servers that are running Windows Server 2016.
Для установки и удаления ролей, служб ролей и компонентов необходимо войти на сервер с правами администратора. You must be logged on to a server as an administrator to install or uninstall roles, role services, and features. Если вы вошли на локальный компьютер с учетной записью, не имеющей прав администратора на целевом сервере, щелкните правой кнопкой мыши целевой сервер на плитке Серверы, выберите Управлять как и укажите учетную запись с правами администратора. If you are logged on to the local computer with an account that does not have administrator rights on your target server, right-click the target server in the Servers tile, and then click Manage As to provide an account that has administrator rights. Сервер, на котором требуется подключить автономный виртуальный жесткий диск, должен быть добавлен в диспетчер серверов. На таком сервере нужны права администратора. The server on which you want to mount an offline VHD must be added to Server Manager, and you must have Administrator rights on that server.
Дополнительные сведения о ролях, службах ролей и компонентах см. в разделе роли, службы ролей и компоненты. For more information about what roles, role services, and features are, see Roles, Role Services, and Features.
В этом разделе содержатся следующие подразделы. This topic contains the following sections.
Установка ролей, служб ролей и компонентов с помощью мастера добавления ролей и компонентов Install roles, role services, and features by using the add Roles and Features Wizard
В одном сеансе мастера добавления ролей и компонентов можно установить роли, службы ролей и компоненты на локальном сервере, на удаленном сервере, который добавлен в диспетчер сервера, или в автономный виртуальный жесткий диск. In a single session in the add Roles and Features Wizard, you can install roles, role services, and features on the local server, a remote server that has been added to Server Manager, or an offline VHD. Дополнительные сведения о добавлении сервера в диспетчер сервера управления см. в разделе Добавление серверов в Диспетчер сервера. For more information about how to add a server to Server Manager to manage, see Add Servers to Server Manager.
Если вы используете диспетчер сервера на Windows Server 2016 или Windows 10, можно использовать мастер добавления ролей и компонентов для установки ролей и компонентов только на серверах и автономных виртуальных жестких дисках, работающих под Windows Server 2016. If you are running Server Manager on Windows Server 2016 or Windows 10, you can use the add Roles and Features Wizard to install roles and features only on servers and offline VHDs that are running Windows Server 2016.
Установка ролей и компонентов с помощью мастера добавления ролей и компонентов To install roles and features by using the add Roles and Features Wizard
Если диспетчер серверов уже открыт, переходите к следующему шагу. If Server Manager is already open, go on to the next step. Если диспетчер серверов еще не открыт, откройте его одним из следующих способов. If Server Manager is not already open, open it by doing one of the following.
На рабочем столе Windows запустите диспетчер серверов, щелкнув Диспетчер серверов на панели задач Windows. On the Windows desktop, start Server Manager by clicking Server Manager in the Windows taskbar.
На начальном экране Windows щелкните плитку Диспетчер сервера . On the Windows start screen, click the Server Manager tile.
В меню Управление выберите команду Добавить роли и компоненты. On the Manage menu, click add Roles and Features.
На странице Приступая к работе убедитесь, что конечный сервер и сетевое окружение подготовлены к установке нужной вам роли или компонента. On the Before you begin page, verify that your destination server and network environment are prepared for the role and feature you want to install. Щелкните Далее. Click Next.
На странице Выбор типа установки выберите Установка ролей или компонентов, чтобы установить все элементы ролей или компонентов на одном сервере, или Установка служб удаленных рабочих столов, чтобы установить инфраструктуру рабочих столов на основе виртуальных машин или сеансов для служб удаленных рабочих столов. On the Select installation type page, select Role-based or feature-based installation to install all parts of roles or features on a single server, or Remote Desktop Services installation to install either a virtual machine-based desktop infrastructure or a session-based desktop infrastructure for Remote Desktop Services. В случае варианта Установка служб удаленных рабочих столов логические части роли служб удаленных рабочих столов нужным образом распределяются администраторами между разными серверами. The Remote Desktop Services installation option distributes logical parts of the Remote Desktop Services role across different servers as needed by administrators. Щелкните Далее. Click Next.
На странице Выбор целевого сервера выберите сервер из пула серверов или автономный виртуальный жесткий диск. On the Select destination server page, select a server from the server pool, or select an offline VHD. Чтобы выбрать автономный виртуальный жесткий диск в качестве конечного сервера, сначала выберите сервер, на котором будет подключен виртуальный жесткий диск, а затем выберите VHD-файл. To select an offline VHD as your destination server, first select the server on which to mount the VHD, and then select the VHD file. Сведения о добавлении серверов в пул серверов см. в разделе Добавление серверов в Диспетчер сервера. For information about how to add servers to your server pool, see Add Servers to Server Manager. Выбрав конечный сервер, нажмите кнопку Далее. After you have selected the destination server, click Next.
Для установки ролей и компонентов на автономных виртуальных жестких дисках целевые виртуальные жесткие диски должны отвечать следующим требованиям. To install roles and features on offline VHDs, target VHDs must meet the following requirements.
На виртуальных жестких дисках должен быть установлен выпуск Windows Server, соответствующий используемой версии диспетчер сервера. VHDs must be running the release of Windows Server that matches the version of Server Manager you are running. См. Примечание в начале установки ролей, служб ролей и компонентов с помощью мастера добавления ролей и компонентов. See the note at the start of Install roles, role services, and features by using the add Roles and Features Wizard.
Виртуальные жесткие диски не должны содержать больше одного системного тома или раздела. VHDs cannot have more than one system volume or partition.
Общая сетевая папка, в которой хранится VHD-файл, должна предоставлять учетной записи компьютера (или локальной системы) для сервера, где будет подключен виртуальный жесткий диск, следующие права доступа. The network shared folder in which the VHD file is stored must grant the following access rights to the computer (or local system) account of server that you have selected to mount the VHD. Одной лишь учетной записи пользователя недостаточно. User-only account access is not sufficient. На общем ресурсе можно предоставить разрешения Чтение и Запись группе Все, чтобы разрешить доступ к виртуальному жесткому диску, но из соображений безопасности делать это не рекомендуется. The share can grant Read and Write permissions to the Everyone group to allow access to the VHD, but for security reasons, this is not recommended.
- Права на Чтение и запись в диалоговом окне Общий доступ к файлам.Read/Write access on the File Sharing dialog box.
- Полный доступ на вкладке Безопасность диалогового окна Свойства файла или папки. Full Control access on the Security tab, file or folder Properties dialog box.
Выберите роли, если необходимо, выберите службы ролей и нажмите кнопку Далее, чтобы выбрать компоненты. Select roles, select role services for the role if applicable, and then click Next to select features.
По мере продолжения мастер добавления ролей и компонентов автоматически информирует вас о том, что на целевом сервере обнаружены конфликты, которые могут препятствовать установке или нормальной работе выбранных ролей или компонентов. As you proceed, the add Roles and Features Wizard automatically informs you if conflicts were found on the destination server that can prevent selected roles or features from installation or normal operation. Также появляется запрос на добавление ролей, служб ролей и компонентов, необходимых для выбранных ролей или компонентов. You are also prompted to add any roles, role services, or features that are required by the roles or features that you have selected.
Кроме того, если планируется удаленное управление ролями либо с другого сервера, либо с компьютера на базе клиента Windows с установленными средствами администрирования удаленного сервера, можно не устанавливать средства управления и оснастки для ролей на конечном сервере. Additionally, if you plan to manage the role remotely, either from another server, or from a Windows client-based computer that is running Remote Server Administration Tools, you can opt not to install management tools and snap-ins for roles on the destination server. По умолчанию в мастере добавления ролей и компонентов для установки выбраны средства управления. By default, in the add Roles and Features Wizard, management tools are selected for installation.
На странице Подтверждение выбранных элементов для установки проверьте выбранные роли, компоненты и серверы. On the Confirm installation selections page, review your role, feature, and server selections. Если все готово к установке, нажмите кнопку Установить. If you are ready to install, click Install.
Вы также можете экспортировать параметры в файл конфигурации на основе XML, который можно использовать для автоматической установки с помощью Windows PowerShell. You can also export your selections to an XML-based configuration file that you can use for unattended installations with Windows PowerShell. Чтобы экспортировать конфигурацию, указанную в этом сеансе мастера добавления ролей и компонентов, щелкните Экспорт параметров конфигурации, а затем сохраните XML-файл в удобном месте. To export the configuration you specified in this add Roles and Features Wizard session, click Export configuration settings, and then save the XML file to a convenient location.
Команда Указать альтернативный исходный путь на странице Подтверждение выбранных элементов для установки позволяет указать альтернативный исходный путь для файлов, необходимых для установки ролей и компонентов на выбранном сервере. The Specify an alternate source path command on the Confirm installation selections page lets you specify an alternate source path for the files that are required to install roles and features on the selected server. В Windows Server 2012 и более поздних версиях Windows Server функции по запросу позволяют сократить объем дискового пространства, используемого операционной системой, путем удаления файлов ролей и компонентов с серверов, которые управляются удаленно. In Windows Server 2012 and later releases of Windows Server, Features on Demand lets you reduce the amount of disk space used by the operating system, by removing role and feature files from servers that are exclusively managed remotely. Удалив файлы ролей и компонентов с сервера при помощи командлета Uninstall-WindowsFeature -remove , в дальнейшем можно установить роли и компоненты на сервер, указав альтернативный исходный путь или общий ресурс, на котором хранятся необходимые файлы ролей и компонентов. If you have removed role and feature files from a server by using the Uninstall-WindowsFeature -remove cmdlet, you can install roles and features on the server in the future by specifying an alternate source path, or a share on which required role and feature files are stored. Исходный путь или общая папка должны предоставлять разрешения на Чтение для группы » все » (не рекомендуется по соображениям безопасности) или учетной записи компьютера (домен \ SERverNAME$) на целевом сервере; предоставление доступа к учетной записи пользователя недостаточна. The source path or file share must grant Read permissions either to the Everyone group (not recommended for security reasons), or to the computer account (DOMAIN\SERverNAME$) of the destination server; granting user account access is not sufficient. Дополнительные сведения о функции «Компоненты по запросу» см. в разделе Варианты установки Windows Server. For more information about Features on Demand, see Windows Server Installation Options.
При установке ролей, служб ролей и компонентов на работающем физическом сервере можно указать WIM-файл в качестве альтернативного источника файлов компонентов. You can specify a WIM file as an alternate feature file source when you are installing roles, role services, and features on a running, physical server. Исходный путь для WIM-файла должен быть в следующем формате, с WIM в качестве префикса и индексом, где файлы компонентов являются суффиксом: WIM:e:\sources\install.wim:4. The source path for a WIM file should be in the following format, with WIM as a prefix, and the index in which the feature files are located as a suffix: WIM:e:\sources\install.wim:4. Однако вы не можете использовать WIM-файл непосредственно в качестве источника для установки ролей, служб ролей и компонентов на автономный виртуальный жесткий диск. необходимо подключить автономный виртуальный жесткий диск и указать путь для его подключения к исходным файлам, или же необходимо указать папку, содержащую копию содержимого WIM-файла. However, you cannot use a WIM file directly as a source for installing roles, role services, and features to an offline VHD; you must either mount the offline VHD and point to its mount path for source files, or you must point to a folder that contains a copy of the contents of the WIM file.
После нажатия кнопки установить на странице ход установки отображаются ход выполнения установки, результаты и сообщения, такие как предупреждения, сбои или действия по настройке после установки, необходимые для установленных ролей или компонентов. After you click Install, the Installation Progress page displays installation progress, results, and messages such as warnings, failures, or post-installation configuration steps that are required for the roles or features that you installed. В Windows Server 2012 и более поздних версиях Windows Server можно закрыть мастер добавления ролей и компонентов в ходе установки, а также просмотреть результаты установки или другие сообщения в области уведомлений в верхней части консоли Диспетчер сервера. In Windows Server 2012 and later releases of Windows Server, you can close the add Roles and Features Wizard while installation is still in progress, and view installation results or other messages in the Notifications area at the top of the Server Manager console. Щелкните значок флага уведомлений , чтобы просмотреть дополнительные сведения об установке или других задачах, выполняемых в Диспетчер сервера. Click the Notifications flag icon to see more details about installations or other tasks that you are performing in Server Manager.
Установка ролей, служб ролей и компонентов при помощи командлетов Windows PowerShell Install roles, role services, and features by using Windows PowerShell cmdlets
Командлеты развертывания диспетчер сервера для Windows PowerShell работают аналогично мастеру добавления ролей и компонентов на основе графического интерфейса, а также мастера удаления ролей и компонентов с ВАЖНОЙ разницей. The Server Manager deployment cmdlets for Windows PowerShell function similarly to the GUI-based add Roles and Features Wizard and remove Roles and Features Wizard, with an IMPORTANT difference. В Windows PowerShell, в отличие от мастера добавления ролей и компонентов, средства управления и оснастки для роли не включаются по умолчанию. In Windows PowerShell, unlike in the add Roles and Features Wizard, management tools and snap-ins for a role are not included by default. Чтобы установить средства управления вместе с ролью, добавьте в командлет параметр IncludeManagementTools . To include management tools as part of a role installation, add the IncludeManagementTools parameter to the cmdlet. При установке ролей и компонентов на сервере, на котором выполняется вариант установки Server Core в Windows Server 2012 или более поздних версиях, можно добавить в установку средства управления роли, но средства управления на основе графического интерфейса пользователя и оснастки не могут быть установлены на серверах, на которых выполняется вариант установки Server Core Windows Server. If you are installing roles and features on a server that is running the Server Core installation option of Windows Server 2012 or later releases, you can add a role’s management tools to an installation, but GUI-based management tools and snap-ins cannot be installed on servers that are running the Server Core installation option of Windows Server. В варианте установки Server Core можно установить только средства командной строки и управления Windows PowerShell. Only command-line and Windows PowerShell management tools can be installed on the Server Core installation option.
Установка ролей и компонентов при помощи командлета Install-WindowsFeature To install roles and features by using the Install-WindowsFeature cmdlet
Выполните одно из следующих действий, чтобы открыть сеанс Windows PowerShell с повышенными правами. Do one of the following to open a Windows PowerShell session with elevated user rights.
Если вы устанавливаете роли и компоненты на удаленном сервере, вам не нужно запускать Windows PowerShell с повышенными правами пользователя. If you are installing roles and features on a remote server, you do not need to run Windows PowerShell with elevated user rights.
На рабочем столе Windows щелкните правой кнопкой мыши Windows PowerShell на панели задач и выберите команду Запустить от имени администратора. On the Windows desktop, right-click Windows PowerShell on the taskbar, and then click Run as Administrator.
На начальном экране Windows щелкните правой кнопкой мыши плитку Windows PowerShell, а затем на панели приложения щелкните Запуск от имени администратора. On the Windows Start screen, right-click the tile for Windows PowerShell, and then on the app bar, click Run as Administrator.
Введите Get-WindowsFeature и нажмите клавишу ВВОД, чтобы просмотреть список доступных и установленных ролей и компонентов на локальном сервере. Type Get-WindowsFeature and then press Enter to view a list of available and installed roles and features on the local server. Если локальный компьютер не является сервером или требуются сведения об удаленном сервере, выполните команду Get-WindowsFeature-computerName , в которой computer_name представляет имя удаленного компьютера под управлением Windows Server 2016. If the local computer is not a server, or if you want information about a remote server, run Get-WindowsFeature -computerName , in which computer_name represents the name of a remote computer that is running Windows Server 2016. Результаты командлета содержат имена команд ролей и компонентов, добавленных в командлет на шаге 4. The results of the cmdlet contain the command names of roles and features that you add to your cmdlet in step 4.
В Windows PowerShell 3,0 и более поздних версиях Windows PowerShell нет необходимости импортировать модуль командлета диспетчер сервера в сеанс Windows PowerShell перед выполнением командлетов, которые являются частью модуля. In Windows PowerShell 3.0 and later releases of Windows PowerShell, there is no need to import the Server Manager cmdlet module into the Windows PowerShell session before running cmdlets that are part of the module. Модуль автоматически импортируется при первом выполнении командлета, входящего в модуль. A module is automatically imported the first time you run a cmdlet that is part of the module. Кроме того, ни командлеты Windows PowerShell, ни имена функций, используемые с командлетами, учитывают регистр. Also, neither Windows PowerShell cmdlets nor the feature names used with the cmdlets are case-sensitive.
Введите Get-Help Install-WindowsFeature и нажмите клавишу Ввод , чтобы просмотреть синтаксис и принять параметры для Install-WindowsFeature командлета. type Get-help Install-WindowsFeature, and then press Enter to view the syntax and accepted parameters for the Install-WindowsFeature cmdlet.
Введите следующую команду и нажмите клавишу Ввод, где feature_name представляет имя команды роли или компонента, которые требуется установить (получено на шаге 2), а computer_name представляет удаленный компьютер, на котором необходимо установить роли и компоненты. type the following, and then press Enter, where feature_name represents the command name of a role or feature that you want to install (obtained in step 2), and computer_name represents a remote computer on which you want to install roles and features. Несколько значений параметра имя_компонента разделяйте запятыми. Separate multiple values for feature_name by using commas. Параметр Restart автоматически перезапускает конечный сервер, если это требуется для установки роли или компонента. The Restart parameter automatically restarts the destination server if required by the role or feature installation.
Чтобы установить роли и компоненты на автономном виртуальном жестком диске, добавьте оба параметра — computerName и VHD . To install roles and features on an offline VHD, add both the computerName parameter and the VHD parameter. Если не добавить параметр computerName , то командлет решит, что доступ к виртуальному жесткому диску должен получить локальный компьютер. If you do not add the computerName parameter, the cmdlet assumes that the local computer is mounted to access the VHD. Параметр computerName содержит имя сервера, на котором следует подключить виртуальный жесткий диск, а параметр VHD — путь к VHD-файлу на указанном сервере. The computerName parameter contains the name of the server on which to mount the VHD, and the VHD parameter contains the path to the VHD file on the specified server.
Необходимо добавить параметр, computerName Если командлет выполняется с компьютера, работающего под управлением клиентской операционной системы Windows. You must add the computerName parameter if you are running the cmdlet from a computer that is running a Windows client operating system.
Для установки ролей и компонентов на автономных виртуальных жестких дисках целевые виртуальные жесткие диски должны отвечать следующим требованиям. To install roles and features on offline VHDs, target VHDs must meet the following requirements.
На виртуальных жестких дисках должен быть установлен выпуск Windows Server, соответствующий используемой версии диспетчер сервера. VHDs must be running the release of Windows Server that matches the version of Server Manager you are running. См. Примечание в начале установки ролей, служб ролей и компонентов с помощью мастера добавления ролей и компонентов. See the note at the start of Install roles, role services, and features by using the add Roles and Features Wizard.
Виртуальные жесткие диски не должны содержать больше одного системного тома или раздела. VHDs cannot have more than one system volume or partition.
Общая сетевая папка, в которой хранится VHD-файл, должна предоставлять учетной записи компьютера (или локальной системы) для сервера, где будет подключен виртуальный жесткий диск, следующие права доступа. The network shared folder in which the VHD file is stored must grant the following access rights to the computer (or local system) account of server that you have selected to mount the VHD. Одной лишь учетной записи пользователя недостаточно. User-only account access is not sufficient. На общем ресурсе можно предоставить разрешения Чтение и Запись группе Все, чтобы разрешить доступ к виртуальному жесткому диску, но из соображений безопасности делать это не рекомендуется. The share can grant Read and Write permissions to the Everyone group to allow access to the VHD, but for security reasons, this is not recommended.
- Права на Чтение и запись в диалоговом окне Общий доступ к файлам.Read/Write access on the File Sharing dialog box.
- Полный доступ на вкладке Безопасность диалогового окна Свойства файла или папки. Full Control access on the Security tab, file or folder Properties dialog box.
Пример: Следующий командлет устанавливает роль доменных служб Active Directory и функцию управления групповая политика на удаленном сервере ContosoDC1. Example: The following cmdlet installs the active directory Domain Services role and the Group Policy Management feature on a remote server, ContosoDC1. Средства управления и оснастки добавляются с использованием параметра IncludeManagementTools , и конечный сервер будет перезагружен автоматически, если этого требует установка. Management tools and snap-ins are added by using the IncludeManagementTools parameter, and the destination server is to be restarted automatically, if installation requires that the servers be restarted.
После завершения установки проверьте установку, открыв страницу все серверы в Диспетчер сервера, выбрав сервер, на котором установлены роли и компоненты, и просмотрев плитку роли и компоненты на странице для выбранного сервера. When installation is finished, verify installation by opening the All Servers page in Server Manager, selecting a server on which you installed roles and features, and viewing the Roles and Features tile on the page for the selected server. Можно также запустить командлет, Get-WindowsFeature предназначенный для выбранного сервера (Get-WindowsFeature-computerName ), чтобы просмотреть список ролей и компонентов, установленных на сервере. You can also run the Get-WindowsFeature cmdlet targeted at the selected server (Get-WindowsFeature -computerName ) to view a list of roles and features that are installed on the server.
Удаление ролей, служб ролей и компонентов с помощью мастера удаления ролей и компонентов Remove roles, role services, and features by using the remove Roles and Features Wizard
Для удаления ролей, служб ролей и компонентов необходимо войти на сервер с правами администратора. You must be logged on to a server as an administrator to uninstall roles, role services, and features. Если вы вошли на локальный компьютер с учетной записью, не имеющей прав администратора на целевом сервере удаления, щелкните правой кнопкой мыши целевой сервер на плитке Серверы, выберите Управлять как и укажите учетную запись с правами администратора. If you are logged on to the local computer with an account that does not have administrator rights on your uninstallation target server, right-click the target server in the Servers tile, and then click Manage As to provide an account that has administrator rights. Сервер, на котором требуется подключить автономный виртуальный жесткий диск, должен быть добавлен в диспетчер серверов. На таком сервере нужны права администратора. The server on which you want to mount an offline VHD must be added to Server Manager, and you must have Administrator rights on that server.
Удаление ролей и компонентов с помощью мастера удаления ролей и компонентов To remove roles and features by using the remove Roles and Features Wizard
Если диспетчер серверов уже открыт, переходите к следующему шагу. If Server Manager is already open, go on to the next step. Если диспетчер серверов еще не открыт, откройте его одним из следующих способов. If Server Manager is not already open, open it by doing one of the following.
На рабочем столе Windows запустите диспетчер серверов, щелкнув Диспетчер серверов на панели задач Windows. On the Windows desktop, start Server Manager by clicking Server Manager in the Windows taskbar.
На начальном экране Windows выберите плитку Диспетчер сервера. On the Windows Start screen, click the Server Manager tile.
В меню Управление выберите команду Удалить роли и компоненты. On the Manage menu, click Remove Roles and Features.
На странице Приступая к работе проверьте, все ли готово к удалению ролей и компонентов с сервера. On the Before you begin page, verify that you have prepared for removing roles or features from a server. Щелкните Далее. Click Next.
На странице Выбор целевого сервера выберите сервер из пула серверов или выберите автономный виртуальный жесткий диск. On the Select Destination Server page, select a server from the server pool, or select an offline VHD. Чтобы выбрать автономный виртуальный жесткий диск, сначала выберите сервер, на котором будет подключен виртуальный жесткий диск, а затем выберите VHD-файл. To select an offline VHD, first select the server on which to mount the VHD, and then select the VHD file.
Общая сетевая папка, в которой хранится VHD-файл, должна предоставлять учетной записи компьютера (или локальной системы) для сервера, где будет подключен виртуальный жесткий диск, следующие права доступа. The network shared folder in which the VHD file is stored must grant the following access rights to the computer (or local system) account of server that you have selected to mount the VHD. Одной лишь учетной записи пользователя недостаточно. User-only account access is not sufficient. На общем ресурсе можно предоставить разрешения Чтение и Запись группе Все, чтобы разрешить доступ к виртуальному жесткому диску, но из соображений безопасности делать это не рекомендуется. The share can grant Read and Write permissions to the Everyone group to allow access to the VHD, but for security reasons, this is not recommended.
- Права на Чтение и запись в диалоговом окне Общий доступ к файлам.Read/Write access on the File Sharing dialog box.
- Полный доступ на вкладке Безопасность в диалоговом окне Свойства файла или папки. Full Control access on the Security tab , file or folder Properties dialog box.
Сведения о добавлении серверов в пул серверов см. в разделе Добавление серверов в Диспетчер сервера. For information about how to add servers to your server pool, see add Servers to Server Manager. Выбрав конечный сервер, нажмите кнопку Далее. After you have selected the destination server, click Next.
Мастер удаления ролей и компонентов можно использовать для удаления ролей и компонентов с серверов, на которых работает тот же выпуск Windows Server, который поддерживает используемую версию диспетчер сервера. You can use the remove Roles and Features Wizard to remove roles and features from servers that are running the same release of Windows Server that supports the version of Server Manager that you are using. Вы не можете удалить роли, службы ролей или компоненты с серверов под Windows Server 2016, если вы используете диспетчер сервера на Windows Server 2012 R2, Windows Server 2012 или Windows 8. You cannot remove roles, role services, or features from servers that are running Windows Server 2016, if you are running Server Manager on Windows Server 2012 R2, Windows Server 2012, or Windows 8. Мастер удаления ролей и компонентов нельзя использовать для удаления ролей и компонентов с серверов под Windows Server 2008 или Windows Server 2008 R2. You cannot use the remove Roles and Features Wizard to remove roles and features from servers that are running Windows Server 2008 or Windows Server 2008 R2.
Выберите роли, если необходимо, выберите службы ролей и нажмите кнопку Далее, чтобы выбрать компоненты. Select roles, select role services for the role if applicable, and then click Next to select features.
По мере продолжения мастер удаления ролей и компонентов автоматически предлагает удалить все роли, службы ролей или компоненты, которые не могут выполняться без удаляемых ролей или компонентов. As you proceed, the remove Roles and Features Wizard automatically prompts you to remove any roles, role services, or features that cannot run without the roles or features that you are removing.
Кроме того, можно отказаться от удаления средств управления и оснасток для ролей на целевом сервере. additionally, you can opt to remove management tools and snap-ins for roles on the destination server. По умолчанию в мастере удаления ролей и компонентов для удаления выбраны средства управления. By default, in the remove Roles and Features Wizard, management tools are selected for removal. Средства управления и оснастки можно оставить, если выбранный сервер планируется использовать для управления ролью на других удаленных серверах. You can leave management tools and snap-ins if you plan to use the selected server to manage the role on other remote servers.
На странице Подтверждение выбора компонентов для удаления проверьте выбранные роли, компоненты и серверы. On the Confirm removal selections page, review your role, feature, and server selections. Если вы готовы удалить роли или компоненты, нажмите кнопку Удалить. If you are ready to remove the roles or features, click remove.
После нажатия кнопки Удалить на странице Ход удаления отображается ход удаления, результаты и сообщения, такие как предупреждения, сбои или необходимые шаги настройки после удаления, например перезапуск сервера назначения. After you click remove, the removal progress page displays removal progress, results, and messages such as warnings, failures, or post-removal configuration steps that are required, such as restarting the destination server. В Windows Server 2012 и более поздних версиях Windows Server можно закрыть мастер удаления ролей и компонентов в ходе удаления, а также просмотреть результаты удаления или другие сообщения в области уведомления в верхней части консоли Диспетчер сервера. In Windows Server 2012 and later releases of Windows Server, you can close the remove Roles and Features Wizard while removal is still in progress, and view removal results or other messages in the Notifications area at the top of the Server Manager console. Щелкните флаг уведомлений , чтобы просмотреть дополнительные сведения об операциях удаления или других задачах, выполняемых в Диспетчер сервера. Click the Notifications flag to see more details about removals or other tasks that you are performing in Server Manager.
Удаление ролей, служб ролей и компонентов при помощи командлетов Windows PowerShell Remove roles, role services, and features by using Windows PowerShell cmdlets
Командлеты развертывания диспетчер сервера для Windows PowerShell работают аналогично мастеру удаления ролей и компонентов на основе графического интерфейса, что существенно отличается. The Server Manager deployment cmdlets for Windows PowerShell function similarly to the GUI-based remove Roles and Features Wizard, with an IMPORTANT difference. В Windows PowerShell, в отличие от мастера удаления ролей и компонентов, средства управления и оснастки для роли не удаляются по умолчанию. In Windows PowerShell, unlike in the remove Roles and Features Wizard, management tools and snap-ins for a role are not removed by default. Чтобы удалить средства управления вместе с ролью, добавьте в командлет параметр IncludeManagementTools . To remove management tools as part of a role removal, add the IncludeManagementTools parameter to the cmdlet. При удалении ролей и компонентов с сервера, на котором выполняется вариант установки Server Core в Windows Server 2012 или более поздней версии Windows Server, этот параметр удаляет средства командной строки и средств управления Windows PowerShell для указанных ролей и компонентов. If you are uninstalling roles and features from a server that is running the Server Core installation option of Windows Server 2012 or a later release of Windows Server, this parameter removes command-line and Windows PowerShell management tools for the specified roles and features.
Удаление ролей и компонентов при помощи командлета Uninstall-WindowsFeature To remove roles and features by using the Uninstall-WindowsFeature cmdlet
Выполните одно из следующих действий, чтобы открыть сеанс Windows PowerShell с повышенными правами. Do one of the following to open a Windows PowerShell session with elevated user rights.
При удалении ролей и компонентов с удаленного сервера не нужно запускать Windows PowerShell с повышенными правами пользователя. If you are uninstalling roles and features from a remote server, you do not need to run Windows PowerShell with elevated user rights.
На рабочем столе Windows щелкните правой кнопкой мыши Windows PowerShell на панели задач и выберите команду Запустить от имени администратора. On the Windows desktop, right-click Windows PowerShell on the taskbar, and then click Run as Administrator.
На начальном экране Windows щелкните правой кнопкой мыши плитку Windows PowerShell, а затем на панели приложения щелкните Запуск от имени администратора. On the Windows start screen, right-click the Windows PowerShell tile, and then on the app bar, click Run as Administrator.
Введите Get-WindowsFeature и нажмите клавишу ВВОД, чтобы просмотреть список доступных и установленных ролей и компонентов на локальном сервере. Type Get-WindowsFeature and then press Enter to view a list of available and installed roles and features on the local server. Если локальный компьютер не является сервером или требуются сведения об удаленном сервере, выполните команду Get-WindowsFeature-computerName , в которой computer_name представляет имя удаленного компьютера под управлением Windows Server 2016. If the local computer is not a server, or if you want information about a remote server, run Get-WindowsFeature -computerName , in which computer_name represents the name of a remote computer that is running Windows Server 2016. Результаты командлета содержат имена команд ролей и компонентов, добавленных в командлет на шаге 4. The results of the cmdlet contain the command names of roles and features that you add to your cmdlet in step 4.
В Windows PowerShell 3,0 и более поздних версиях Windows PowerShell нет необходимости импортировать модуль командлета диспетчер сервера в сеанс Windows PowerShell перед выполнением командлетов, которые являются частью модуля. In Windows PowerShell 3.0 and later releases of Windows PowerShell, there is no need to import the Server Manager cmdlet module into the Windows PowerShell session before running cmdlets that are part of the module. Модуль автоматически импортируется при первом выполнении командлета, входящего в модуль. A module is automatically imported the first time you run a cmdlet that is part of the module. Кроме того, ни командлеты Windows PowerShell, ни имена функций, используемые с командлетами, учитывают регистр. Also, neither Windows PowerShell cmdlets nor the feature names used with the cmdlets are case-sensitive.
Введите Get-Help uninstall-WindowsFeature и нажмите клавишу Ввод , чтобы просмотреть синтаксис и принять параметры для Uninstall-WindowsFeature командлета. type Get-help Uninstall-WindowsFeature, and then press Enter to view the syntax and accepted parameters for the Uninstall-WindowsFeature cmdlet.
Введите указанный ниже командлет, а затем нажмите клавишу Ввод. Здесь имя_компонента представляет имя команды роли или компонента, которые требуется удалить (полученной на шаге 2), а имя_компьютера — удаленный компьютер, из которого требуется удалить роли и компоненты. Type the following, and then press Enter, where feature_name represents the command name of a role or feature that you want to remove (obtained in step 2), and computer_name represents a remote computer from which you want to remove roles and features. Несколько значений параметра имя_компонента разделяйте запятыми. Separate multiple values for feature_name by using commas. Параметр Restart автоматически перезапускает конечные серверы, если это требуется для удаления роли или компонента. The Restart parameter automatically restarts destination servers if required by the role or feature removal.
Чтобы удалить роли и компоненты с автономного виртуального жесткого диска, добавьте оба параметра — computerName и VHD . To remove roles and features from an offline VHD, add both the computerName parameter and the VHD parameter. Если не добавить параметр computerName , то командлет решит, что доступ к виртуальному жесткому диску должен получить локальный компьютер. If you do not add the computerName parameter, the cmdlet assumes that the local computer is mounted to access the VHD. Параметр computerName содержит имя сервера, на котором следует подключить виртуальный жесткий диск, а параметр VHD — путь к VHD-файлу на указанном сервере. The computerName parameter contains the name of the server on which to mount the VHD, and the VHD parameter contains the path to the VHD file on the specified server.
Необходимо добавить параметр, computerName Если командлет выполняется с компьютера, работающего под управлением клиентской операционной системы Windows. You must add the computerName parameter if you are running the cmdlet from a computer that is running a Windows client operating system.
Общая сетевая папка, в которой хранится VHD-файл, должна предоставлять учетной записи компьютера (или локальной системы) для сервера, где будет подключен виртуальный жесткий диск, следующие права доступа. The network shared folder in which the VHD file is stored must grant the following access rights to the computer (or local system) account of server that you have selected to mount the VHD. Одной лишь учетной записи пользователя недостаточно. User-only account access is not sufficient. На общем ресурсе можно предоставить разрешения Чтение и Запись группе Все, чтобы разрешить доступ к виртуальному жесткому диску, но из соображений безопасности делать это не рекомендуется. The share can grant Read and Write permissions to the Everyone group to allow access to the VHD, but for security reasons, this is not recommended.
- Права на Чтение и запись в диалоговом окне Общий доступ к файлам.Read/Write access on the File Sharing dialog box.
- Полный доступ на вкладке Безопасность диалогового окна Свойства файла или папки. Full Control access on the Security tab, file or folder Properties dialog box.
Пример: Следующий командлет удаляет роль доменных служб Active Directory и функцию управления групповая политика с удаленного сервера ContosoDC1. Example: The following cmdlet removes the active directory Domain Services role and the Group Policy Management feature from a remote server, ContosoDC1. Средства управления и оснастки также удаляются, и конечный сервер будет перезапущен автоматически, если это требуется для удаления. Management tools and snap-ins are also removed, and the destination server is to be restarted automatically, if removal requires that the servers be restarted.
После завершения удаления убедитесь, что роли и компоненты удалены, открыв страницу все серверы в Диспетчер сервера, выбрав сервер, с которого были удалены роли и компоненты, и просмотрев плитку роли и компоненты на странице для выбранного сервера. When removal is finished, verify that the roles and features are removed by opening the All Servers page in Server Manager, selecting the server from which you removed roles and features, and viewing the Roles and Features tile on the page for the selected server. Можно также запустить командлет, Get-WindowsFeature предназначенный для выбранного сервера (Get-WindowsFeature-computerName ), чтобы просмотреть список ролей и компонентов, установленных на сервере. You can also run the Get-WindowsFeature cmdlet targeted at the selected server (Get-WindowsFeature -computerName ) to view a list of roles and features that are installed on the server.
Установка ролей и компонентов на нескольких серверах при помощи сценария Windows PowerShell Install roles and features on multiple servers by running a Windows PowerShell script
Хотя мастер добавления ролей и компонентов нельзя использовать для установки ролей, служб ролей и компонентов на нескольких целевых серверах в одном сеансе мастера, можно использовать сценарий Windows PowerShell для установки ролей, служб ролей и компонентов на нескольких целевых серверах, управляемых с помощью диспетчер сервера. Although you cannot use the add Roles and Features Wizard to install roles, role services, and features on more than one target server in a single wizard session, you can use a Windows PowerShell script to install roles, role services, and features on multiple target servers that you are managing by using Server Manager. Скрипт, используемый для выполнения пакетного развертывания, по мере вызова этого процесса указывает на XML-файл конфигурации, который можно легко создать с помощью мастера добавления ролей и компонентов, а также нажав кнопку Экспорт параметров конфигурации после перехода мастера на страницу Подтверждение выбора установки в мастере добавления ролей и компонентов. The script that you use to perform batch deployment, as this process is called, points to an XML configuration file that you can create easily by using the add Roles and Features Wizard, and clicking Export configuration settings after advancing through the wizard to the Confirm installation selections page of the add Roles and Features Wizard.
На всех целевых серверах, указанных в сценарии, должен выполняться выпуск Windows Server, соответствующий версии диспетчер сервера, выполняемой на локальном компьютере. All target servers that are specified in your script must be running the release of Windows Server that matches the version of Server Manager you are running on the local computer. Например, если вы используете диспетчер сервера в Windows 10, вы можете установить роли, службы ролей и компоненты на серверах под Windows Server 2016. For example, if you are running Server Manager on Windows 10, you can install roles, role services, and features on servers that are running Windows Server 2016. Если в установку добавляются средства управления на основе графического пользовательского интерфейса, то процесс установки автоматически преобразует целевые серверы, на которых выполняется установка основных серверных компонентов Windows Server, в режим полной установки (сервер с полным графическим интерфейсом пользователя, также называемый работающей графической оболочкой сервера). If GUI-based management tools are added to the installation, the installation process automatically converts target servers that are running the Server Core installation option of Windows Server to the full installation option (server with a full GUI, also known as running Server Graphical Shell).
Сценарий, приведенный в этом разделе, является примером того, как можно выполнить пакетное развертывание с помощью Install-WindowsFeature командлета и сценария Windows PowerShell. The script provided in this section is an example of how batch deployment can be performed by using the Install-WindowsFeature cmdlet and a Windows PowerShell script. Есть и другие сценарии и методы пакетного развертывания на нескольких серверах. There are other possible scripts and methods of performing batch deployment to multiple servers. Другие сценарии для развертывания ролей и компонентов можно найти в репозитории центра сценариев. To search for or provide other scripts for deploying roles and features, search the Script Center Repository.
Установка ролей и компонентов на нескольких серверах To install roles and features on multiple servers
Создайте XML-файл конфигурации, содержащий роли, службы ролей и компоненты, которые необходимо установить на нескольких серверах, если вы еще этого не сделали. If you have not already done so, create an XML configuration file that contains the roles, role services, and features that you want installed on multiple servers. Чтобы создать этот файл конфигурации, запустите мастер добавления ролей и компонентов, выберите нужные роли, службы ролей и компоненты и нажмите кнопку Экспорт параметров конфигурации после перехода мастера на страницу Подтверждение выбранных вариантов установки . You can create this configuration file by running the add Roles and Features Wizard, selecting roles, role services, and features that you want, and clicking Export configuration settings after advancing through the wizard to the Confirm installation selections page. Сохраните файл конфигурации в удобном месте. Save the configuration file to a convenient location. Не нужно нажимать кнопку Установить или выполнять мастер до конца, если вы используете его только для создания файла конфигурации. You do not need to click Install or complete the wizard if you are running it only to create a configuration file.
Выполните одно из следующих действий, чтобы открыть сеанс Windows PowerShell с повышенными правами. Do one of the following to open a Windows PowerShell session with elevated user rights.
На рабочем столе Windows щелкните правой кнопкой мыши Windows PowerShell на панели задач и выберите команду Запустить от имени администратора. On the Windows desktop, right-click Windows PowerShell on the taskbar, and then click Run as Administrator.
На начальном экране Windows щелкните правой кнопкой мыши плитку Windows PowerShell, а затем на панели приложения щелкните Запуск от имени администратора. On the Windows start screen, right-click the Windows PowerShell tile, and then on the app bar, click Run as Administrator.
Скопируйте и вставьте следующий скрипт в сеанс Windows PowerShell. Copy and paste the following script into your Windows PowerShell session.
Целевые серверы будут автоматически перезапущены, если этого требуют выбранные роли и компоненты. Target servers are automatically restarted if required by the roles and features that you select.
Запустите функцию следующим образом. Run the function by doing the following.
Создайте переменную, где будут храниться имена конечных компьютеров, разделенные запятыми. Create a variable in which to store the names of your target computers, separated by commas. В следующем примере в переменной $ServerNames хранятся имена целевых серверов Contoso_01 и Contoso_02. In the following example, the variable $ServerNames stores the names of target servers Contoso_01 and Contoso_02. Нажмите клавишу ВВОД. Press Enter.
Чтобы запустить функцию, введите следующую команду и нажмите клавишу ВВОД, где $ServerNames — пример переменной, созданной в предыдущем шаге, а C:\Users\Sampleuser\Desktop\DeploymentConfigTemplate.xml — пример пути к файлу конфигурации, созданному на шаге 1. To run the function, type the following, and then press Enter, where $ServerNames is an example of the variable that you created in the preceding step, and C:\Users\Sampleuser\Desktop\DeploymentConfigTemplate.xml is an example of a path to the configuration file that you created in step 1.
Invoke-Виндовсфеатуребатчдеплоймент-computerNames $ServerNames-Конфигуратионфилепас C:\Users\Sampleuser\Desktop\DeploymentConfigTemplate.xml Invoke-WindowsFeatureBatchDeployment -computerNames $ServerNames -ConfigurationFilepath C:\Users\Sampleuser\Desktop\DeploymentConfigTemplate.xml
После завершения установки проверьте установку, открыв страницу все серверы в Диспетчер сервера, выбрав сервер, на котором установлены роли и компоненты, и просмотрев плитку роли и компоненты на странице для выбранного сервера. When installation is finished, verify installation by opening the All Servers page in Server Manager, selecting a server on which you installed roles and features, and viewing the Roles and Features tile on the page for the selected server. Можно также запустить командлет, Get-WindowsFeature предназначенный для определенного сервера ( Get-WindowsFeature -computerName ), чтобы просмотреть список ролей и компонентов, установленных на сервере. You can also run the Get-WindowsFeature cmdlet targeted at a specific server ( Get-WindowsFeature -computerName ) to view a list of roles and features that are installed on the server.
Установка по требованию .NET Framework 3.5 и других компонентов Install .NET Framework 3.5 and other features on-demand
начиная с Windows Server 2012 и Windows 8, файлы компонентов для платформа .NET Framework 3,5 (которые включают платформа .NET Framework 2,0 и платформа .NET Framework 3,0) недоступны на локальном компьютере по умолчанию. starting with Windows Server 2012 and Windows 8, the feature files for .NET Framework 3.5 (which includes .NET Framework 2.0 and .NET Framework 3.0) are not available on the local computer by default. Данные файлы удалены. The files have been removed. Файлы компонентов, удаленных в конфигурации функции «Компоненты по требованию», вместе с файлами компонентов для .NET Framework 3.5 доступны в Центре обновления Windows. Files for features that have been removed in a Features on Demand configuration, along with feature files for .NET Framework 3.5, are available through Windows Update. По умолчанию, если файлы компонентов недоступны на целевом сервере под управлением Windows Server 2012 или более поздней версии, процесс установки выполняет поиск недостающих файлов, подключаясь к Центр обновления Windows. By default, if feature files are not available on the destination server that is running Windows Server 2012 or later releases, the installation process searches for the missing files by connecting to Windows Update. Поведение по умолчанию можно переопределить, настроив параметр групповая политика или указав альтернативный исходный путь во время установки, независимо от того, выполняется ли установка с помощью графического интерфейса мастера добавления ролей и компонентов или командной строки. You can override the default behavior by configuring a Group Policy setting or specifying an alternate source path during installation, whether you are installing by using the add Roles and Features Wizard GUI or a command line.
Компонент .NET Framework 3.5 можно установить, выполнив одно из описанных ниже действий. You can install .NET Framework 3.5 by doing one of the following.
Воспользуйтесь разделом Порядок установки .NET Framework 3.5 с помощью командлета Install-WindowsFeature, чтобы добавить параметр Source , и укажите источник файлов компонентов .NET Framework 3.5. Use To install .NET Framework 3.5 by running the Install-WindowsFeature cmdlet to add the Source parameter, and specify a source from which to get .NET Framework 3.5 feature files. Без добавления параметра Source в процессе установки сначала определяется, указан ли путь к файлам компонентов в параметрах групповой политики, и если такой путь не найден, поиск недостающих файлов компонентов осуществляется с помощью Центра обновления Windows. If you do not add the Source parameter, the installation process first determines if a path to feature files has been specified by Group Policy settings, and if no such path is found, searches for missing feature files by using Windows Update.
Используйте для установки платформа .NET Framework 3,5 с помощью мастера добавления ролей и компонентов , чтобы указать альтернативное расположение исходного файла на странице Подтверждение параметров установки мастера добавления ролей и компонентов. Use To install .NET Framework 3.5 by using the add Roles and Features Wizard to specify an alternate source file location on the Confirm installation options page of the add Roles and Features Wizard.
Воспользуйтесь разделом Установка .NET Framework 3.5 с помощью DISM, чтобы получить файлы из Центра обновления Windows по умолчанию или указав исходный путь к установочному носителю. Use To install .NET Framework 3.5 by using DISM to get files from Windows Update by default, or by specifying a source path to installation media.
Настройте альтернативные источники файлов компонентов в групповой политике для .NET Framework 3.5 или других компонентов, если файлы компонентов не обнаружены на локальном компьютере. Configure alternate sources for feature files in Group Policy for .NET Framework 3.5 or other features, if feature files are not found on the local computer.
При установке файлов компонентов из удаленного источника права на Чтение в исходном пути или файловом ресурсе общего доступа необходимо присвоить группе Все (не рекомендуется по соображениям безопасности) или учетной записи компьютера (локальная система) конечного сервера; предоставления доступа учетной записи пользователя недостаточно. When you are installing feature files from a remote source, the source path or file share must grant Read permissions either to the Everyone group (not recommended for security reasons), or to the computer (local system) account of the destination server; granting user account access is not sufficient.
Серверы в рабочих группах не могут получить доступ к внешним файловым ресурсам, даже если учетная запись компьютера для сервера рабочей группы имеет права на Чтение внешнего общего ресурса. Servers that are in workgroups cannot access external file shares, even if the computer account for the workgroup server has Read permissions on the external share. Другие исходные расположения, действующие для серверов рабочих групп, включают установочные носители, Центр обновления Windows и VHD- или WIM-файлы, хранящиеся на локальном сервере рабочей группы. Alternate source locations that work for workgroup servers include installation media, Windows Update, and VHD or WIM files that are stored on the local workgroup server.
При установке ролей, служб ролей и компонентов на работающем физическом сервере можно указать WIM-файл в качестве альтернативного источника файлов компонентов. You can specify a WIM file as an alternate feature file source when you are installing roles, role services, and features on a running, physical server. Исходный путь для WIM-файла должен быть в следующем формате, с WIM в качестве префикса и индексом, где файлы компонентов являются суффиксом: WIM:e:\sources\install.wim:4. The source path for a WIM file should be in the following format, with WIM as a prefix, and the index in which the feature files are located as a suffix: WIM:e:\sources\install.wim:4. Однако вы не можете использовать WIM-файл непосредственно в качестве источника для установки ролей, служб ролей и компонентов на автономный виртуальный жесткий диск. необходимо подключить автономный виртуальный жесткий диск и указать путь для его подключения к исходным файлам, или же необходимо указать папку, содержащую копию содержимого WIM-файла. However, you cannot use a WIM file directly as a source for installing roles, role services, and features to an offline VHD; you must either mount the offline VHD and point to its mount path for source files, or you must point to a folder that contains a copy of the contents of the WIM file.
Порядок установки .NET Framework 3.5 с помощью командлета Install-WindowsFeature To install .NET Framework 3.5 by running the Install-WindowsFeature cmdlet
Выполните одно из следующих действий, чтобы открыть сеанс Windows PowerShell с повышенными правами. Do one of the following to open a Windows PowerShell session with elevated user rights.
Если вы устанавливаете роли и компоненты с удаленного сервера, не нужно запускать Windows PowerShell с повышенными правами пользователя. if you are installing roles and features from a remote server, you do not need to run Windows PowerShell with elevated user rights.
На рабочем столе Windows щелкните правой кнопкой мыши Windows PowerShell на панели задач и выберите команду Запустить от имени администратора. On the Windows desktop, right-click Windows PowerShell on the taskbar, and then click Run as Administrator.
На начальном экране Windows щелкните правой кнопкой мыши плитку Windows PowerShell, а затем на панели приложения щелкните Запуск от имени администратора. On the Windows start screen, right-click the Windows PowerShell tile, and then on the app bar, click Run as Administrator.
На сервере, на котором работает вариант установки Server Core Windows Server 2012 R2 или Windows Server 2012, введите PowerShell в командную строку и нажмите клавишу Ввод. On a server that is running the Server Core installation option of Windows Server 2012 R2 or Windows Server 2012 , type PowerShell into a command prompt, and then press Enter.
Введите следующую команду и нажмите клавишу Ввод. type the following command, and then press Enter. В примере ниже исходные файлы находятся в хранилище параллельных компонентов (также называется SxS) на установочном носителе на диске D. In the following example, the source files are located in a side-by-side store (abbreviated to as SxS) in installation media on drive D.
Если нужно, чтобы в качестве источника недостающих файлов компонентов использовался Центр обновления Windows, или источник по умолчанию уже настроен с помощью групповой политики, параметр Source следует добавлять только для указания альтернативного источника. If you want the command to use Windows Update as a source for missing feature files, or if a default source has already been configured by using Group Policy, you do not need to add the Source parameter unless you want to specify a different source.
Установка платформа .NET Framework 3,5 с помощью мастера добавления ролей и компонентов To install .NET Framework 3.5 by using the add Roles and Features Wizard
В меню Управление в Диспетчер сервера выберите команду Добавить роли и компоненты. On the Manage menu in Server Manager, click add Roles and Features.
Выберите целевой сервер под Windows Server 2016. Select a destination server that is running Windows Server 2016.
На странице Выбор компонентов мастера добавления ролей и компонентов выберите платформа .NET Framework 3,5. On the select features page of the add Roles and Features Wizard, select .NET Framework 3.5.
Если локальному компьютеру разрешено это делать настройками групповой политики, процесс установки пытается получить недостающие файлы компонентов с помощью Центра обновления Windows. If the local computer is allowed to do so by Group Policy settings, the installation process attempts to get missing feature files by using Windows Update. Нажмите кнопку Установить; переходить к следующему шагу не нужно. Click Install; you do not need to go on to the next step.
Если параметры групповая политика не допускают этого, или вы хотите использовать другой источник для файлов компонентов платформа .NET Framework 3,5, на странице мастера Подтверждение выбора установки нажмите указать альтернативный исходный путь. if Group Policy settings do not allow this, or you want to use another source for the .NET Framework 3.5 feature files, on the Confirm installation selections page of the wizard, click Specify an alternate source path.
Предоставьте путь к хранилищу соседствующих (side-by-side) компонентов (также называется SxS) в установочном носителе или к WIM-файлу. Provide a path to a side-by-side store (referred to as SxS) in installation media, or to a WIM file. В примере ниже установочный носитель находится на диске D. In the following example, installation media is located on drive D.
д:\саурцес\сксс\ D:\Sources\SxS\
Чтобы указать WIM-файл, добавьте префикс WIM: и индекс образа для использования в WIM-файле в качестве суффикса, как показано в примере ниже. To specify a WIM file, add a WIM: prefix, and add the index of the image to use in the WIM file as a suffix, as shown in the following example.
WIM- \ \ файл: server_name\шаре\инсталл.Вим: 3 WIM:\\server_name\share\install.wim:3
Нажмите кнопку ОК, а затем кнопку Установить. Click OK, and then click Install.
Установка .NET Framework 3.5 с помощью DISM To install .NET Framework 3.5 by using DISM
Выполните одно из следующих действий, чтобы открыть сеанс Windows PowerShell с повышенными правами. Do one of the following to open a Windows PowerShell session with elevated user rights.
Если вы устанавливаете роли и компоненты с удаленного сервера, не нужно запускать Windows PowerShell с повышенными правами пользователя. if you are installing roles and features from a remote server, you do not need to run Windows PowerShell with elevated user rights.
На рабочем столе Windows щелкните правой кнопкой мыши Windows PowerShell на панели задач и выберите команду Запустить от имени администратора. On the Windows desktop, right-click Windows PowerShell on the taskbar, and then click Run as Administrator.
На начальном экране Windows щелкните правой кнопкой мыши плитку Windows PowerShell, а затем на панели приложения щелкните Запуск от имени администратора. On the Windows Start screen, right-click the Windows PowerShell tile, and then on the app bar, click Run as Administrator.
На сервере, на котором работает вариант установки Server Core, введите PowerShell в командную строку и нажмите клавишу Ввод. On a server that is running the Server Core installation option, type PowerShell into a command prompt, and then press Enter.
Используйте одну из указанных ниже команд DISM. Run one of the following DISM commands.
Если компьютер имеет доступ к Центр обновления Windows или расположение исходного файла по умолчанию уже настроено в групповая политика, выполните следующую команду. if the computer has access to Windows Update, or a default source file location has already been configured in Group Policy, run the following command.
Если у компьютера есть доступ к установочному носителю, выполните команду, аналогичную приведенной ниже. if the computer has access to installation media, run a command similar to the following. В примере ниже установочный носитель операционной системы находится на диске D. Параметр LimitAccess не позволяет команде связаться с Центром обновления Windows или сервером, на котором выполняются службы WSUS. In the following example, the operating system installation media is located on drive D. The LimitAccess parameter prevents the command from attempting to contact Windows Update or a server that is running WSUS.
В команде DISM учитывается регистр. The DISM command is case-sensitive.
Настройка альтернативных источников файлов компонентов в групповой политике Configure alternate sources for feature files in Group Policy
Параметр групповой политики, описанный в этом разделе, указывает расположение авторизованного источника файлов .NET Framework 3.5 и файлов других компонентов, которые удалены как часть конфигурации «Компоненты по требованию». The Group Policy setting described in this section specifies authorized source locations for .NET Framework 3.5 files, and other feature files that have been removed as part of a Features on Demand configuration. Параметр политики задает параметры для установки дополнительных компонентов и восстановления компонентов находится в папке компьютер \ конфигурация темплатес\систем в консоль управления групповыми политиками или в редакторе локальных групповая политика. The policy setting Specify settings for optional component installation and component repair is located in the computer Configuration\Administrative Templates\System folder in the Group Policy Management Console or Local Group Policy editor.
Для изменения параметров групповой политики на локальном компьютере требуется быть членом группы «Администраторы». You must be a member of the Administrators group to change Group Policy settings on the local computer. Если параметры групповой политики нужного компьютера управляются на уровне домена, для их изменения необходимо быть членом группы «Администраторы домена». If Group Policy settings for the computer you want to manage are controlled at the domain level, you must be a member of the Domain Administrators group to change Group Policy settings.
Порядок настройки пути по умолчанию к альтернативному источнику в групповой политике To configure a default alternate source path in Group Policy
В редакторе локальных групповая политика или консоль управления групповыми политиками откройте следующий параметр политики. In Local Group Policy editor or Group Policy Management Console, open the following policy setting.
компьютер \ конфигурация Темплатес\систем\спеЦифи параметры для установки дополнительного компонента и восстановления компонентов computer Configuration\Administrative Templates\System\Specify settings for optional component installation and component repair
Выберите Включить, чтобы включить данный параметр политики, если он еще не включен. Select Enabled to enable the policy setting, if it is not already enabled.
В текстовом поле Альтернативный путь к исходным файлам в области Параметры укажите полный путь к общей папке или WIM-файлу. In the Alternate source file path text box in the Options area, specify a fully qualified path to a shared folder or a WIM file. Чтобы указать WIM-файл в качестве альтернативного расположения исходных файлов, добавьте префикс WIM: к пути и индекс образа для использования в WIM-файле в качестве суффикса. To specify a WIM file as an alternate source file location, add the prefix WIM: to the path, and add the index of the image to use in the WIM file as a suffix. Ниже приводятся примеры возможных значений. The following are examples of values that you can specify.
путь к общей папке: \\ server_name\шаре \folder_name path to a shared folder: \\server_name\share\folder_name
путь к WIM-файлу, в котором 3 представляет индекс изображения, в котором найдены файлы компонентов: WIM: \ \server_name\шаре\инсталл.Вим: 3 path to a WIM file, in which 3 represents the index of the image in which the feature files are found: WIM:\\server_name\share\install.wim:3
Если вы не хотите, чтобы на компьютерах, управляемых этим параметром политики, выполнялся поиск отсутствующих файлов компонентов в Центр обновления Windows, установите флажок никогда не пытаться скачивать полезные данные из центр обновления Windows. if you do not want computers that are controlled by this policy setting to search for missing feature files in Windows Update, select Never attempt to download payload from Windows Update.
Если компьютеры, которые управляются данным параметром политики обычно получают обновления с помощью служб WSUS, но вы предпочитаете использовать для поиска недостающих файлов компонентов Центр обновления Windows, а не WSUS, выберите Напрямую обращаться в Центр обновления Windows, чтобы загрузить контент для восстановления вместо использования служб WSUS. If the computers that are controlled by this policy setting typically receive updates through WSUS, but you prefer to go through Windows Update and not WSUS to find missing feature files, select Contact Windows Update directly to download repair content instead of Windows Server Update Services (WSUS).
После завершения изменения данного параметра политики нажмите кнопку ОК, а затем закройте редактор групповых политик. Click OK when you are finished changing this policy setting, and then close the Group Policy editor.