- 로그온한 사용자의 SID, Group Membership, User Rights를 확인하는 명령어이다.
- 가장 간단하게 확인하는 것은 whoami.exe 이다
-
Whoami.exe의 도움말을 보고자 하면 whoami.exe /?
- Whoami.exe /?
- Whoami.exe
- Whoami.exe /all (가장 많이 확인하는 명령어이다)
- Whoami.exe /user
- Whoami.exe /groups
- Whoami.exe /?
-
이제는 화면에 Display되는 형식을 지정하자.
- Whoami.exe /groups /fo Table (기본 포맷이다.)
- Whoami.exe /groups /fo List
- Whoami.exe /groups /fo CSV
- Whoami.exe /groups /fo Table (기본 포맷이다.)
-
CSV(Comma-separated Values, 쉼표로 구분된 값)로 Display했을 때 말끔하지 않으므로 CSV를 명확하게 보기 위해서는 형식을 변경할 필요가 있다. 즉, ConvertFrom-CSV를 사용하여 원본인 CSV를 Method가 있는 개체로 변환하면 된다.
- Whoami.exe /groups /fo CSV
- Whoami.exe /groups /fo CSV | ConvertFrom-CSV (한층 보기가 좋다)
- Whoami.exe /groups /fo CSV
-
이제는 변환한 것을 표 형식으로 보면 제일 좋다.
- Whoami.exe /groups /fo CSV | ConvertFrom-CSV | Out-GridView
- 여기서 원하는 값만 보기 위해서 필터링 항목에 적절한 값을 입력하면 된다.
- Whoami.exe /groups /fo CSV | ConvertFrom-CSV | Out-GridView
-
파일로 저장하고 싶으면 다음과 같이 하면 된다.
- Whoami.exe /groups /fo CSV | ConvertFrom-CSV | Out-File .\groupmembership.csv
- Whoami.exe /groups /fo CSV | ConvertFrom-CSV | Out-File .\groupmembership.csv
-
우리는 여기서 ConvertFrom-CSV cmdlet를 경험했다. 다음과 같이하여 기본 속성을 변환하여 가져오거나 저장하는 cmdlet를 확인해보자.
-
Get-Command Convert*
-
Advertisements