Subscribe to Windows IT Pro
June 29, 2009 12:00 AM

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

Windows IT Pro
InstantDoc ID #102367
Rating: (0)

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.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.