Installing roles and features using Windows PowerShell
To install server roles and features on more than one server at the same time, or to script role and feature installations in more complex scenarios, using Server Manager is not practical, nor does it provide the desired functionality, such as managing multiple servers at once. This is where Windows PowerShell excels, controlling server with either GUI or Server Core version. PowerShell is a task-based command shell and scripting language developed by Microsoft for the purpose of configuration management and task automation. It is based on the .NET Framework, is open source, and can be installed on Windows, macOS, and Linux platforms.
To install server roles and features using Windows PowerShell, you need to run a PowerShell session with elevated user rights, unless you are installing them on a remote server.
To list roles and features that are available locally on a server, type Get-WindowsFeature or Get-WindowsFeature -computerName <computer_name>, where <computer_name> represents the name of the remote computer you are connecting to. The roles are listed first, followed by the features. In PowerShell terminology, the term role is not used, only features; cmdlets do not differentiate between the two. The following screenshot shows the output of the Windows PowerShell Get-WindowsFeature command:

To install a server role or a feature type, enter the following command:
Install-WindowsFeature -Name <feature_name> -computerName <computer_name>
To install multiple roles and features, separate values using a comma. The management tools needed to manage installed roles and features will be also installed, and your computer will restart if required once the command completes. The following PowerShell command will install the DNS role and XPS Viewer onto a computer using FQDN SRV1.MCSAGUIDE.LOCAL:
Install-WindowsFeature -Name DNS,XPS-Viewer -ComputerName srv1.mcsacertguide.local -IncludeManagementTools -Restart
To verify the installation, run the Get-WindowsFeature command or open Server Manager. On the All Servers page, right-click on a server and select Add Roles and Features.
If needed, list all currently installed features using Windows PowerShell on a target server with the Get-WindowsFeature command. To uninstall or remove roles and features, type the following command:
Uninstall-WindowsFeature -Name <feature_name> -computerName <computer_name> -Restart.
The -Restart switch is not mandatory, but will initiate a computer restart if this is necessary to complete the removal process.
- 基于LabWindows/CVI的虛擬儀器設計與應用
- Hands-On Machine Learning on Google Cloud Platform
- 流處理器研究與設計
- Visual C++編程全能詞典
- 網(wǎng)絡組建與互聯(lián)
- Apache Superset Quick Start Guide
- 中國戰(zhàn)略性新興產(chǎn)業(yè)研究與發(fā)展·工業(yè)機器人
- 筆記本電腦維修90個精選實例
- 中國戰(zhàn)略性新興產(chǎn)業(yè)研究與發(fā)展·智能制造裝備
- Hadoop應用開發(fā)基礎
- C++程序設計基礎(上)
- 學練一本通:51單片機應用技術
- 會聲會影X4中文版從入門到精通
- 空間機器人
- Red Hat Enterprise Linux 5.0服務器構建與故障排除