Q. The output from Get-WindowsFeature doesn't help me. How can I query whether a role or feature is installed?
June 28, 2009
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-VDisplay 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, InstalledDisplayName Installed----------- ---------Hyper-V TruePS C:> Get-WindowsFeature DHCP | ft DisplayName, InstalledDisplayName 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.
About the Author
You May Also Like