
Get-ADComputer cmdlet을 실행하면 아래와 같이 단일 개체의 속성을 모두 볼 수 있습니다.
C:\PS>Get-ADComputer "Fabrikam-SRV1" -Properties *
AccountExpirationDate :
accountExpires : 9223372036854775807
AccountLockoutTime :
AccountNotDelegated : False
AllowReversiblePasswordEncryption : False
BadLogonCount :
CannotChangePassword : False
CanonicalName : Fabrikam.com/Computers/fabrikam-srv1
그런 다음 출력에 표시할 속성을 필터링할 수 있습니다. 파일(txt 또는 csv)의 컴퓨터 개체 목록에 대한 모든 속성을 가져온 다음 필요한 항목을 필터링할 수 있습니까?
이 같은Get-ADComputer -Computer (Get-Content -Path .\computers.txt) | Select CanonicalName,CN,DistinguishedName
답변1
파일(txt 또는 csv)의 컴퓨터 개체 목록에 대한 모든 속성을 가져온 다음 필요한 항목을 필터링할 수 있습니까?
예. 파일에 computers.txt
한 줄에 컴퓨터 이름이 하나만 포함되어 있다고 가정합니다.
Get-Content computers.txt |
Get-ADComputer -Properties * |
Select-Object CanonicalName, CN, DistinguishedName
또한 -Properties *
(많은 컴퓨터를 처리하는 경우 속도가 느려질 수 있음)을 건너뛰고 기본 속성 외에 검색할 속성을 선택할 수도 있습니다. 이 DistinguishedName
기본 세트에 포함되어 있습니다.
Get-ADComputer -Properties CanonicalName, CN
CSV가 있는 경우 다음을 결정해야 합니다.어느열 또는 제목 이름에는 컴퓨터 이름이 포함됩니다. CSV 형식의 예시를 제공해 주시면 답변을 업데이트하겠습니다.