Install-WindowsFeature
Use Install-WindowsFeature to install a Windows Server role or feature — AD DS, IIS, DNS, DHCP — with its management tools, in one command.
Documentation: Microsoft Learn — install-windowsfeature
Syntax
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Examples
Install AD DS with its management tools
Show reference output
Illustrative output · values vary by environment
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Active Directory Domain Services, Group Policy Management}Install IIS with every sub-feature
Show reference output
Illustrative output · values vary by environment
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Web Server (IIS), IIS Management Console, ...}Install and restart if the role needs it
Show reference output
Illustrative output · values vary by environment
(installs DHCP, then restarts the server automatically if required)
Parameters
Parameter definitions:
-Name— Role or feature names to install. Accepts an array.-IncludeManagementTools— Also installs the GUI and PowerShell tools for the role. Almost always want this.-IncludeAllSubFeature— Installs every sub-feature under the named role, not just the parent.-Source— Alternate install source, such as a mounted ISO or a WIM file path.-Restart— Restarts the computer automatically if the install requires it. Without this, you must restart manually.
Always check the restart flag before you walk away
The output's Restart Needed column is the most important field. A role install that needs a restart and does not get one leaves the server half-configured, and the next command in your script may fail in confusing ways. Either pass -Restart or check the result and restart deliberately.
If installation fails with a source error, the feature files were removed from the image. Point -Source at a mounted Windows Server ISO, for example -Source D:\Sources\SxS, or at a WIM file with the wim: prefix.
On Windows Server Core there is no GUI, so -IncludeManagementTools installs the management consoles you will use from another machine. Skipping it on a Core server leaves you managing the role remotely with no local tools at all.
Check what is installed with Get-WindowsFeature
Restart after install with Restart-Computer
Updated 25 October 2026. Browser outputs are fictional; check the installed module help for your environment.
Recap
Install-WindowsFeature Use Install-WindowsFeature to install a Windows Server role or feature — AD DS, IIS, DNS, DHCP — with its management tools, in one command.
Next: New Netfirewallrule