Export (0) Print
Expand All

Install-WindowsFeature

Install-WindowsFeature

Installs one or more Windows Server roles, role services, or features.

Aliases

The following abbreviations are aliases for this cmdlet:

  • Add-WindowsFeature

Syntax

Parameter Set: ComponentNamesAndRunningComputer
Install-WindowsFeature [-Name] <Feature[]> [-ComputerName <String> ] [-Credential <PSCredential> ] [-IncludeAllSubFeature] [-IncludeManagementTools] [-LogPath <String> ] [-Restart] [-Source <String[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ComponentNamesAndVhdPath
Install-WindowsFeature [-Name] <Feature[]> -Vhd <String> [-ComputerName <String> ] [-Credential <PSCredential> ] [-IncludeAllSubFeature] [-IncludeManagementTools] [-LogPath <String> ] [-Source <String[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ConfigurationFile
Install-WindowsFeature -ConfigurationFilePath <String> [-ComputerName <String> ] [-Credential <PSCredential> ] [-LogPath <String> ] [-Restart] [-Source <String[]> ] [-Vhd <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The Install-WindowsFeature cmdlet installs the specified roles, role services, and features on a computer that is running Windows Server® “8” Beta, or on an offline virtual hard disk (VHD) on which Windows Server “8” Beta is installed. This cmdlet works similarly to the Add Roles and Features Wizard that can be run from Server Manager.
Administrative privileges are needed to run this cmdlet on the target computer.

Parameters

-ComputerName<String>

Installs the list of available role, role services and features on the specified remote computer. Accepts only one computer name. The default is the local computer.
The NetBIOS name, an IP address, or a fully qualified domain name of a remote computer can be specified. Note: The target computer should be running Windows Server “8” Beta.
To use an IP address in the value of this parameter, the cmdlet must include the Credential parameter. The computer must also be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the WinRM TrustedHosts list, see How to Add a Computer to the Trusted Host List in about_Remote_Troubleshooting.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ConfigurationFilePath<String>

Provides a list of file paths to configuration files which specify the roles to be installed and any configuration parameters needed. The path can be specified by using a local relative path (such as D:\myfolder) or by using built-in environment variables prefixed with the $env tag (such as $env:systemdrive\filename). Configuration files can be generated by running Add Roles and Features Wizard from Server Manager.
If this parameter is specified, then the Name parameter cannot be used.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies a user account that has permission to perform this action. The default for this parameter is the current user.
Enter a user name in one of the following formats surrounded by quotes:
"UserName"
"Domain\User"
"User@Domain.com"
● A Credential object returned by the Get-Credential cmdlet.
If a user name is typed, then a prompt for a password with be displayed.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IncludeAllSubFeature

Specifies that all subordinate role services and features of the parent roles, role services, or features specified by the Name parameter should be installed.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IncludeManagementTools

Specifies that all applicable management tools of the roles, role services, or features specified by the Name parameter should be installed. Note: Management tools are not installed by default, when you are using this cmdlet.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LogPath<String>

Specifies a name and location for a log file. Add this parameter if the results of this cmdlet must be stored in a log.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<Feature[]>

Specifies a list of features to install. This parameter does not support wildcard characters. If this parameter is specified, then the ConfigurationFilePath parameter cannot be used.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Restart

Specifies that the target computer restarts if required at the end of the installation. This parameter cannot be used with the Vhd parameter.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Source<String[]>

Specifies the path to feature files if the files are not present in the local store of the target computer or VHD. A network path or the path to a mounted image can be specified. The path is specified by using a local relative path or by using built-in environment variables prefixed with the $env tag as follows:
D:\myfolder
$env:systemdrive\filename.
The path specified by this parameter is only used if the feature files are not found in the local side by side store of target computer or VHD. This cmdlet searches for feature files in the following order:
1) Location of the target computer or VHD.
2) Path specified by this parameter. When using UNC paths, make sure that the computer account of the target machine has read permissions on the share. Use the following format for the computer account:
● ○ DOMAIN\SERVERNAME$
3) Repository path specified by a Group Policy Object (GPO). A path is specified by the following registry key (through a GP setting) on the target computer:
● ○ HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing\LocalSourcePath
4) Windows Update.
This parameter is an optional parameter.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Vhd<String>

Specifies the path to an offline VHD. The path can point to a VHD file or to a location on which the VHD is already mounted using Deployment Image Servicing and Management (DISM) tools.
The VHD can be present on a local hard disk attached to the target computer or on a network share.
If the VHD is present on a network share, then specify the UNC path to the VHD. In this case, the computer account in which the VHD is mounted must have read and write permissions on the network share, otherwise the VHD cannot be accessed. Local loopback UNC paths are not supported. Use the following format for the computer account: DOMAIN\SERVERNAME$
Use the ComputerName parameter to specify the target computer to be used for mounting the VHD. If the ComputerName parameter is not specified, then the local computer is used. The computer on which the VHD is mounted must be running Windows Server “8” Beta. Any local path, such as D:\myFolder, specified with this parameter is always relative to the target computer.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.


Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.String[]
  • Microsoft.Windows.ServerManager.Commands.Feature

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Windows.ServerManager.Commands.FeatureOperationResult

Examples

Example 1

This example displays what will be installed with the Web Server role, including all role services, on a computer named Server1. However, by using the WhatIf parameter, nothing is actually installed.


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

Example 2

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


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

Example 3

This example installs all the roles, role services and features specified in the configuration file named ADCSConfigFile.xml. The configuration file was previously created by running the Add Roles and Features Wizard from Server Manager.


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

Example 4

This example installs the Active Directory Certificate Services (AD CS) role specified in the configuration file named ADCSConfigFile.xml on a list of computers obtained from the user. The configuration file was previously created by running the Add Roles and Features Wizard from Server Manager.


PS C:\> ForEach-Object -Process $server in $args

PS C:\> Install-WindowsFeature -ConfigurationFilePath D:\ConfigurationFiles\ADCSConfigFile.xml -ComputerName $server

Example 5

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


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

Example 6

This example installs the Web Server feature on the local computer, specifying that the file source to use for the installation is on a computer named Server2.


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

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft