PowerShell을 사용하여 Microsoft 365 사용자 계정 보기
이 문서는 Microsoft 365 Enterprise와 Office 365 Enterprise에 모두 적용됩니다.
Microsoft 365 관리 센터 사용하여 Microsoft 365 테넌트 계정을 볼 수 있습니다. Microsoft 365용 PowerShell을 사용하면 이 기능을 사용할 수 있지만 추가 기능도 제공합니다.
Microsoft Graph PowerShell을 사용하여 사용자 계정 보기
참고
AzureAD(Azure Active Directory) PowerShell 모듈은 더 이상 사용되지 않으며 Microsoft Graph PowerShell SDK로 대체됩니다. Microsoft Graph PowerShell SDK를 사용하여 모든 Microsoft Graph API에 액세스할 수 있습니다. 자세한 내용은 Microsoft Graph PowerShell SDK 시작하기를 참조하세요.
Microsoft Graph PowerShell을 각각 설치하고 업그레이드하는 방법에 대한 자세한 내용은 Microsoft Graph PowerShell SDK 설치 및 Azure AD PowerShell에서 Microsoft Graph PowerShell로 업그레이드를 참조하세요.
먼저 Microsoft Graph PowerShell을 사용하는 데 필요한 소프트웨어를 설치합니다. 자세한 내용은 Microsoft Graph PowerShell을 사용하여 Microsoft 365에 연결을 참조하세요.
그런 다음 다음 cmdlet을 실행하여 필요한 권한 scope 사용하여 organization 연결합니다. 이 경우 User.ReadBasic.All입니다.
# Connect to Microsoft Graph
Connect-Graph -Scopes User.ReadBasic.All
모든 계정 보기
사용자 ID 및 사용자 계정 이름을 사용하여 사용자 계정의 전체 목록을 표시하려면 다음 명령을 실행합니다.
Get-MgUser -All | Select DisplayName,Id,UserPrincipalName
다음과 유사한 정보를 가져와야 합니다.
DisplayName Id UserPrincipalName
----------- -- -----------------
Conf Room Adams 6e206948-b2b6-406c-a728-80bbe78e4003 Adams@M365x89521157.OnMicrosoft.com
Adele Vance 916a6a08-b9d0-44b6-870f-562d8358a314 AdeleV@M365x89521157.OnMicrosoft.com
MOD Administrator 5710f237-df3f-4bcd-b875-82deb02f98aa admin@M365x89521157.onmicrosoft.com
Alex Wilber 8aa561dc-441d-4d74-aeb3-e2be41c116c8 AlexW@M365x89521157.OnMicrosoft.com
Allan Deyoung 6b629e5e-3cf4-42d0-8007-3a93f0253382 AllanD@M365x89521157.OnMicrosoft.com
Automate Bot 3a70feb4-9407-47b5-9b61-7526ac0e98d8 AutomateB@M365x89521157.OnMicrosoft.com
Conf Room Baker d8cf3fef-1d03-4b9c-9be0-fed44fb87596 Baker@M365x89521157.OnMicrosoft.com
Bianca Pisani 7fe8c2d1-eb8e-4032-96ba-26242ff0acd9 BiancaP@M365x89521157.OnMicrosoft.com
특정 계정 보기
특정 사용자 계정을 표시하려면 다음 명령을 실행합니다. UPN(사용자 계정 이름)으로도 알려진 사용자 계정의 로그인 계정 이름을 입력합니다. "" 및 "<>" 문자를 제거합니다.
Get-MgUser -UserId '<user principal name>'
다음은 예입니다.
Get-MgUser -UserId 'BelindaN@litwareinc.onmicosoft.com'
특정 계정에 대한 추가 속성 값 보기
기본적으로 Get-MgUser cmdlet은 계정의 DisplayName, Id, Mail 및 UserPrincipalName 속성만 표시합니다.
표시할 속성에 대해 더 선택적이려면 Get-MgUser cmdlet과 함께 Select cmdlet을 사용합니다. 두 cmdlet을 결합하려면 PowerShell에 한 명령의 결과를 가져와서 다음 명령으로 보내도록 지시하는 "파이프" 문자("|")를 사용합니다. 다음은 모든 사용자 계정에 대한 DisplayName, Department 및 UsageLocation 을 표시하는 예제 명령입니다.
Get-MgUser -All | Select DisplayName,Department,UsageLocation
이 명령은 PowerShell에 다음을 지시합니다.
사용자 계정에 대한 모든 정보(Get-MgUser)를 가져와서 다음 명령(|)으로 보냅니다.
사용자 계정 이름, 부서 및 사용 위치만 표시합니다(DisplayName, Department, UsageLocation 선택).
특정 사용자 계정에 대한 모든 속성을 보려면 Select cmdlet 및 와일드카드 문자(*)를 사용합니다. 다음은 예입니다.
Get-MgUser -UserID 'BelindaN@litwareinc.onmicosoft.com' | Select *
또 다른 예로 다음 명령을 실행하여 특정 사용자 계정의 활성화된 상태 검사.
Get-MgUser -UserID '<sign-in name of the user account>' | Select DisplayName,UserPrincipalName,AccountEnabled
계정 동기화 상태 보기
사용자 계정에는 다음 두 가지 원본이 있습니다.
온-프레미스 AD에서 클라우드로 동기화되는 계정인 AD(Windows Server Active Directory)입니다.
Microsoft Entra 클라우드에서 직접 만들어지는 계정입니다.
다음 명령을 사용하여 온-프레미스 AD에서 동기화하는 계정을 찾을 수 있습니다. OnPremisesSyncEnabled 특성을 가진 모든 사용자를 True로 설정하도록 PowerShell에 지시합니다.
Get-MgUser -All -Filter 'OnPremisesSyncEnabled eq true'
다음 명령을 사용하여 클라우드 전용 계정을 찾을 수 있습니다. PowerShell에 OnPremisesSyncEnabled 특성이 False로 설정되었거나 설정되지 않은 모든 사용자를 얻도록 지시합니다(Null). 온-프레미스 AD에서 동기화되지 않은 계정에 는 OnPremisesSyncEnabled가Null로 설정됩니다. 온-프레미스 AD에서 처음 동기화되었지만 더 이상 동기화되지 않는 계정에 는 OnPremisesSyncEnabled 가 False로 설정됩니다.
Get-MgUser -All | Where OnPremisesSyncEnabled -ne true
OnPremisesSyncEnabled```
### View accounts based on a common property
To be more selective about the list of accounts to display, you can use the **Where** cmdlet in combination with the **Get-MgUser** cmdlet. To combine the two cmdlets, use the "pipe" character ("|"), which tells PowerShell to take the results of one command and send it to the next command. Here is an example command that displays only those user accounts that have an unspecified usage location:
```powershell
Get-MgUser | Where UsageLocation -eq $Null
이 명령은 PowerShell에 다음을 지시합니다.
사용자 계정에 대한 모든 정보(Get-MgUser)를 가져와서 다음 명령(|)으로 보냅니다.
지정되지 않은 사용 위치(UsageLocation -eq $Null)가 있는 모든 사용자 계정을 찾습니다. 명령은 UsageLocation 사용자 계정 속성(UsageLocation)이 지정되지 않은 계정 집합만 찾도록 PowerShell에 지시합니다(-eq $Null).
UsageLocation 속성은 사용자 계정과 연결된 여러 속성 중 하나일 뿐입니다. 특정 사용자 계정에 대한 모든 속성을 표시하려면 Select cmdlet 및 와일드카드 문자(*)를 사용합니다. 다음은 예입니다.
Get-MgUser -UserID BelindaN@litwareinc.onmicosoft.com | Select *
예를 들어 City 는 사용자 계정 속성의 이름입니다. 다음 명령을 사용하여 런던에 거주하는 사용자의 모든 계정을 나열할 수 있습니다.
Get-MgUser | Where City -eq "London"
팁
이 예제에서 Where cmdlet의 구문은 Where [user account property name] [comparison operator] [value] value입니다.> [비교 연산자]는 -eq for equals, -ne for not equals, -lt for less than, -gt for greater than 및 기타입니다. [value]는 일반적으로 문자열(문자, 숫자 및 기타 문자 시퀀스), 숫자 값 또는 지정되지 않은 $Null . 자세한 내용은 위치를 참조하세요.
참고 항목
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기