Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


Return to article

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.





Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement