Get-WindowsFeature
Updated: February 25, 2014
Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2
Get-WindowsFeature
Syntax
Parameter Set: Default Get-WindowsFeature [[-Name] <String[]> ] [-ComputerName <String> ] [-Credential <PSCredential> ] [-LogPath <String> ] [-Vhd <String> ] [ <CommonParameters>]
Detailed Description
The Get-WindowsFeature
cmdlet gets information about roles, role services, and features that are both available for installation and already installed on a computer that is running Windows Server 2012 R2 or an offline virtual hard disk (VHD) that is running Windows Server 2012 R2.
Parameters
-ComputerName<String>
Gets the list of available roles, role services, and features from the specified remote computer that is running Windows Server 2012 R2. The parameter accepts only one computer name. If this parameter is not added, or no computer name is specified, the default target is the local computer. Valid values for the parameter include a NetBIOS name, an IP address, or a fully qualified domain name of a remote computer.
To use a remote computer’s IP address as the value of this parameter, your command must include the Credential
parameter. The computer must either 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 information about 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 |
Cn |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Credential<PSCredential>
Specifies a user account that has access rights to perform this action. If the parameter is not added, or no value is specified, the default value of this parameter is the current user. Enter a user name in one of the following formats. Quotation marks are optional.
-- "UserName"
-- "Domain\User"
-- "User@Domain.com"
-- A Credential object returned by the Get-Credential cmdlet.
If a user name is entered, then a prompt for a password is displayed.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-LogPath<String>
Specifies a name and path to 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<String[]>
Specifies the command IDs of roles, role services, or features about which to return information.
Aliases |
none |
Required? |
false |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-Vhd<String>
Specifies the path to an offline VHD. The path can either point to a VHD file, or to a location on which the VHD is already mounted by using Deployment Image Servicing and Management (DISM) tools.
The VHD can be on a local disk on the target computer, or on a network shared folder. If the VHD is in a network shared folder, then the value of this parameter is a UNC path to the VHD. In this case, the computer account of the computer that you are using to mount the VHD must have read and write permissions (Read/Write permissions in the File Sharing dialog box, or Full Control on the Security tab of the folderProperties dialog box) on the shared folder, or the VHD will not be accessible. Local loopback UNC paths are not supported. Use either of the following formats for the computer account: DOMAIN\SERVERNAME$ or SERVERNAME$.
Add the ComputerName
parameter to specify the target computer you want to use to mount the VHD. If the ComputerName
parameter is not specified, then the local computer is used. The computer that you are using to mount the VHD must be running Windows Server 2012 R2. Any local path, such as D:\myFolder, that is specified by using 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 |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
- System.String[]
Outputs
The output type is the type of the objects that the cmdlet emits.
- Microsoft.Windows.ServerManager.Commands.Feature[]
Examples
EXAMPLE 1
This example gets a list of features that is available and installed on the target computer named Server1. The credentials for user user1 in theContoso.com domain, a user who has Administrator rights on Server1, are provided.
PS C:\> Get-WindowsFeature -ComputerName Server1 -Credential contoso.com\user1
EXAMPLE 2
This example returns a list of features that is available and installed on the specified offline VHD located at D:\ps-test\vhd1.vhd.
PS C:\> Get-WindowsFeature -Vhd D:\ps-test\vhd1.vhd
EXAMPLE 3
This example returns a list of available and installed features that have a command ID starting with AD or Web.
PS C:\> Get-WindowsFeature -Name AD*, Web*
EXAMPLE 4
This example returns a list of features that is installed on a specified server, Server01.
PS C:\> Get-WindowsFeature –ComputerName Server01 | Where Installed
EXAMPLE 5
This example returns a list of features on a specified server, Server01, that have installation files removed from the local side-by-side store, and require an external file source for installation.
PS C:\> Get-WindowsFeature –ComputerName Server01 | Where InstallState -Eq Removed