Installing Windows features from the command-line with PowerShell
Posted: (EET/GMT+2)
Sometimes you need to add or remove Windows Server features quickly without using Server Manager. Fortunately, PowerShell provides a complete way to manage Windows features directly from the command-line.
To list all available features, use:
Get-WindowsFeature
To install a feature, use Install-WindowsFeature. For example, to install IIS:
Install-WindowsFeature Web-Server
You can also install multiple features at once, or include management tools with the "-IncludeManagementTools" parameter:
Install-WindowsFeature Web-Server, Web-Asp-Net45 -IncludeManagementTools
To remove a feature, use Uninstall-WindowsFeature. And to check installation results, PowerShell will return an object containing success status and reboot requirements.
These commands work in both Windows Server Core and full installations. They're especially useful for automation scripts, provisioning new servers, or configuring test environments.