PowerShell Genie

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.

Command 4 min read Windows PowerShell 5.1 · Windows Server only

Documentation: Microsoft Learn — install-windowsfeature

Syntax

1PS> Install-WindowsFeature [-Name] <String[]> [-IncludeManagementTools] [-IncludeAllSubFeature] [-Source <String[]>] [-Restart] [-ComputerName <String>] [-Credential <PSCredential>] [<CommonParameters>]

Try it

Windows PowerShell

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.

Interactive simulation · fictional data

Examples

Install AD DS with its management tools

1PS> Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
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

1PS> Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -IncludeManagementTools
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

1PS> Install-WindowsFeature -Name DHCP -IncludeManagementTools -Restart
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.

Microsoft Learn — install-windowsfeature

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
Genie guideInstall-WindowsFeature

Install-WindowsFeature installs server roles and features from PowerShell: add AD DS to a new domain controller, install IIS with all sub-features, or script a whole server build. Requires administrator rights. The console below is pre-loaded — run it, then change a value and run it again.