How to Get Windows features using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To get the windows features and roles available or installed using PowerShell, you need to use the Get-WIndowsFeature cmdlet. That is obvious that Windows features and roles are available only on the server operating systems not on the client operating system.

When you run the Get-WindowsFeature on the server operating system from Windows server 2008 onwards using PowerShell, you will get the output as below.

The crossed symbol in the square box indicates that the feature is installed. You can also check the same using ‘Install State’. To get only Installed features on the server, you need to filter out the Install state feature.

Get-WindowsFeature | where{$_.InstallState -eq "Installed"}

Output

To get the windows features/roles which are not installed, you need to filter out the Install State with property value “Available” or using the NOT operator by the INSTALLED value.

Get-WindowsFeature | where{!($_.InstallState -eq "Installed")}

Output

If you need to find a specific feature/role, you just need to type the Name or Display Name. If you don’t know the full name of the feature/role, the wildcard character is allowed to complete the search operation. For example,

Get-WindowsFeature *Remote*

Output

To check the installed features on the remote servers, you need to run the above command with -ComputerName parameter. For example, we need to retrieve two features RemoteAccess and ADRMS then we can use the below command.

Get-WindowsFeature -ComputerName Test1-Win2k16 -Name ADRMS,Remoteaccess

Output

If you need to retrieve windows feature information from multiple remote servers then you can use Invoke-Command because Get-WindowsFeature command with -ComputerName parameter doesn’t support the array and with Invoke-Command, you can also get the computer name on which particular features are installed. For example,

Invoke-Command -ComputerName Test1-Win2k16,Test1-Win2k12 -ScriptBlock{Get- WindowsFeature ADRMS,RemoteAccess}

Output

You can also search the windows feature using Wildcard character (*). For example,

Invoke-Command -ComputerName Test1-win2k16 -ScriptBlock{Get-WindowsFeature *Backup*}

raja
Published on 26-Aug-2020 08:17:22
Advertisements