그 외

PowerShell - gm 사용. Select-Object로 사용한 값이 이상한 것 같을 때

yj42 2021. 7. 23. 10:08

> Get-Entity -Collection users

 

위의 결과 중 Type이 user인 것만 추출하고 싶다면

> Get-Entity -Collection users -Type user

 

위의 결과 중 Name, Type의 값만 가져오고 싶을 때

> Get-Entity -Collection users -Type user | Select-Object name,type

 

type의 경우 값이 나오지 않고 있음 > Select-Object에서 type이 아닌 다른 이름으로 검색해야 함 > 그 이름을 알아내기 위해 gm 사용

> Get-Entity -Collection users -Type user | gm

 

type이 아닌 _type으로 검색해야 함을 파악

> Get-Entity -Collection users -Type user | Select-Object name,_type