Reputation: 105
I am trying to create a script that would highlight missing features by comparing features I need installed with the installed features on a server, that I placed in my array variable in powershell. But I cannot figure out why the installed state is not displaying on my powershell?
This is the script:
$InstallState = "Install State"
Get-WindowsFeature | Select-Object "Name",$InstallState | Where-Object {$_.$InstallState -like "Available"}
I have also tried this
$InstallState = "Install State"
Get-WindowsFeature | Select-Object "Name",$InstallState
I get the Name, but the Install State is blank.
Upvotes: 0
Views: 1721
Reputation: 8868
There is no space. You can see the members with the Get-Member
command
Get-WindowsFeature | Get-Member
InstallState Property Microsoft.Windows.ServerManager.Commands.InstallState InstallState {get;}
Simply change it to
$InstallState = "InstallState"
Get-WindowsFeature | Select-Object "Name",$InstallState | Where-Object {$_.$InstallState -like "Available"}
Upvotes: 1