
방금 PowerShell을 시작했는데 이 명령에 대한 질문이 있습니다.
Get-WindowsFeature | where installed
설치된 기능이 반환됩니다. 이제 모든 기능을 제거하거나 사용 가능하게 하고 싶지만 "설치됨"을 제거됨/사용 가능으로 바꾸면 아무 것도 표시되지 않습니다. 이유는 무엇입니까?
고마워요!
답변1
귀하의 예에서 Installed
확인한 것은 부울 속성이었습니다. 그것은 true 또는 false이며, 그것이 있는 모든 객체를 확인하고 있었습니다 $True
.
Removed
은 속성이 아닌 Available
의 가능한 값입니다 .InstallState
당신은 이것을 볼 수 있습니다
PS> Get-Windowsfeature | Get-Member
TypeName: Microsoft.Windows.ServerManager.Commands.Feature
Name MemberType Definition
---- ---------- ----------
<extra removed>
Installed Property bool Installed {get;}
InstallState Property Microsoft.Windows.ServerManager.Commands.InstallState InstallState {get;}
<extra removed>
다음 중 하나를 시도해 보세요.
Get-Windowsfeature | Where-Object { -not $_.Installed }
Get-WindowsFeature | Where-Object { $_.InstallState -eq "Available" }
Get-WindowsFeature | Where-Object { $_.InstallState -eq "Removed" }