How to Get Windows Features using PowerShell on Server
In this article, I will demonstrate how to get windows features using PowerShell on servers. The Get-WindowsFeature cmdlet lists all the windows features installed on a server.
If you are asked to find the features installed on a specific server, you can use PowerShell to complete the task. Manually listing down the installed features will take time, and you cannot do this when you have multiple servers in the setup.
There are many ways to locate the installed features on the server, including Configuration Manager and third-party tools. But, PowerShell is the most straightforward and cost-free way to discover what features are installed on Windows servers.
About Get-WindowsFeature Cmdlet
TheGet-WindowsFeature cmdletgets information about features that are both available for installation and already installed on a computer that is running Windows Server or an offline virtual hard disk (VHD) that is running Windows Server.
Clearly,Windows features and rolesare only available on server operating systems and not on client operating systems. Therefore, theGet-WindowsFeaturecmdlet can only be executed on Server Operating systems.
You can specify the following parameters along with the Get-WindowsFeature cmdlet.
- -Name
- -Vhd
- -ComputerName
- -Credential
- -LogPath
How to Get Windows Features using PowerShell
Let’s go through some examples of using theGet-WindowsFeaturecmdlet to get Windows roles and features using PowerShell.
List all the Windows Features on Server
Run the below PowerShell command to list all the features that are available and installed on the Windows Server.
Get-WindowsFeature
In the command output, a summary of all installed and available features for installation on the server is displayed. The display name column displays the Windows feature’s name, while the “Install State” column indicates whether a feature is installed or available.
Find All Installed Features on Windows Server
If you want to find out the features that are installed on a given Windows Server, run the following command in PowerShell window.
Get-WindowsFeature | where{$_.InstallState -eq "Installed"}
In the screenshot below, we see the PowerShell command output shows all the Windows features installed on the server.
List all Windows Features that are not Installed
To list the Windows features that are not installed on a server, you can use the below PowerShell command.
Get-WindowsFeature | where{!($_.InstallState -eq "Installed")}
Get Installed Windows Features using Name or Wildcard
如果你需要找到一个特定的功能安装啊n the server, simply input the Name or Display Name. If you don’t know the whole name of the feature/role, you can use the wildcard character to find the features.
For example, on a Windows Server, if you want to find the installed features that begin with “Cert“, you can use the following command.
Get-WindowsFeature *Cert*
The below command output shows all the Windows Features whose name begins with Cert.
[X] Active Directory Certificate Services AD-Certificate Installed [X] Certification Authority ADCS-Cert-Authority Installed [ ] Online Responder ADCS-Online-Cert Available [ ] Centralized SSL Certificate Support Web-CertProvider Available [ ] IIS Client Certificate Mapping Authe... Web-Cert-Auth Available
Find Installed Features on Remote Windows Server
If you want to list the Windows features installed on a remote Windows Server, it is possible using the PowerShell. This method is convenient because you don’t have to log in to the remote Windows Server to get the features.
Run the following command in the PowerShell window to get the list of Windows features installed on the remote server. The below command gets all the installed features on a remote server whose name begins with remote.
Get-WindowsFeature -ComputerName "ServerName" -Name *Remote*
You can find the list of installed features on multiple remote Windows servers using the below PowerShell command. Before you run the command, substitute the computer names with the server names.
Invoke-Command -ComputerName computername1,computername2 -ScriptBlock {Get-WindowsFeature *remote*}