Skip navigation

Q. The output from Get-WindowsFeature doesn't help me. How can I query whether a role or feature is installed?

A. By default, the output from Get-WindowsFeature shows a check box if a role or feature is installed, as shown here.

PS C:\> Get-WindowsFeature Hyper-V

Display Name Name
------------ ----
\[X\] Hyper-V Hyper-V

This matches the format of the servermanagercmd -query command but goes against what most people prefer with PowerShell, which is objects returned with properties you can easily query. You do have access to this kind of return, however. A property, Installed, is also returned. This property is a Boolean showing if the role or feature is installed. You can see this by formatting the output differently. For example

PS C:\> Get-WindowsFeature Hyper-V | ft DisplayName, Installed

DisplayName Installed
----------- ---------
Hyper-V     True


PS C:\> Get-WindowsFeature DHCP | ft DisplayName, Installed

DisplayName Installed
----------- ---------
DHCP Server False

Here you can see that I queried for the DisplayName and Installed properties and a Boolean for the installation status was returned.

Related Reading

Videos:

Audio:


Check out hundreds more useful Q&As like this in John Savill's FAQ for Windows. Also, watch instructional videos made by John at ITTV.net.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish