PowerShell Logo Small

Add-WindowsFeature



This is the built-in help made by Microsoft for the command 'Add-WindowsFeature', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Installs one or more roles, role services, or features on either the local or a specified remote server that is running Windows Server 2012 R2. This cmdlet is equivalent to and replaces Add-WindowsFeature, the cmdlet that was used to install roles, role services, and features in Windows Server 2008 R2.

SYNTAX


Install-WindowsFeature [-Name] <Feature[]> [-ComputerName <String>] [-Credential <PSCredential>] [-IncludeAllSubFeature] [-IncludeManagementTools] [-LogPath <String>]
[-Restart] [-Source <String[]>] [-Confirm] [-WhatIf] [<CommonParameters>]
Install-WindowsFeature [-ComputerName <String>] [-Credential <PSCredential>] [-LogPath <String>] [-Restart] [-Source <String[]>] [-Vhd <String>] -ConfigurationFilePath
<String> [-Confirm] [-WhatIf] [<CommonParameters>]
Install-WindowsFeature [-Name] <Feature[]> [-ComputerName <String>] [-Credential <PSCredential>] [-IncludeAllSubFeature] [-IncludeManagementTools] [-LogPath <String>]
[-Source <String[]>] -Vhd <String> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Install-WindowsFeature cmdlet installs the specified roles, role services, and features on a computer that is running Windows Server 2012 R2, or on an offline virtual
hard disk (VHD) on which Windows Server 2012 R2 is installed. This cmdlet works similarly to the Add Roles and Features Wizard in Server Manager, with an important
exception: the cmdlet does not install management tools for roles, role services, and features by default. To install management tools such as snap-ins on a target server,
you must add the IncludeManagementTools parameter to your command.


This cmdlet requires elevation; you must be running a Windows PowerShell session as an administrator to use this cmdlet.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=287571
Get-WindowsFeature
Uninstall-WindowsFeature
Enable-ServerManagerStandardUserRemoting
Disable-ServerManagerStandardUserRemoting

REMARKS

<

Examples


EXAMPLE 1

PS C:\> Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -ComputerName Server1 -WhatIf



This example shows what is installed with Web Server (IIS), including all role services, on a computer named Server1. By adding the WhatIf parameter, you can view the
results of the installation command without running it.




EXAMPLE 2

PS C:\> Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -IncludeManagementTools -ComputerName Server1 -Credential contoso.com\johnj99



This example installs Web Server (IIS), including all role services and applicable management tools, on a computer named Server1, by using the credentials of a user account
named contoso.com\johnj99.




EXAMPLE 3

PS C:\> Install-WindowsFeature -ConfigurationFilePath d:\ConfigurationFiles\ADCSConfigFile.xml



This example installs all roles, role services and features that are specified in a configuration file named ADCSConfigFile.xml. The configuration file was created by
clicking Export configuration settings on the Confirm installation selections page of the Add Roles and Features Wizard in Server Manager.




EXAMPLE 4

PS C:\> $servers = (‘server1’, ‘server2’)
PS C:\> foreach ($server in $servers) {Install-WindowsFeature -ConfigurationFilePath D:\ConfigurationFiles\ADCSConfigFile.xml -ComputerName $server}



This example installs Active Directory Certificate Services (AD CS) as specified in a configuration file named ADCSConfigFile.xml. AD CS is installed on a list of computers
that is contained in the variable $servers. The configuration file was created by clicking Export configuration settings on the Confirm installation selections page of the
Add Roles and Features Wizard in Server Manager. On the first line, the value of the $servers variable is set; on the second line, the installation instructions in the
ADCSConfigFile.xml configuration file are applied to each of the servers that has been named in $servers.




EXAMPLE 5

PS C:\> Get-WindowsFeature –Name Web-* | Install-WindowsFeature



This example retrieves a list of all Windows features beginning with the characters Web, and then pipes the resulting list to Install-WindowsFeature. The result of this
cmdlet is all features that start with Web are installed on the local computer.




EXAMPLE 6

PS C:\> Install-WindowsFeature -Name Web-Server -Source \\server2\winsxs



This example installs Web Server (IIS) on the local computer, specifying that the source of feature files for the installation is a folder, winsxs, on a computer named
Server2. The computer account of the local computer must have Read permissions on the specified share.