PowerShell을 사용하여 사용이 허가된 Microsoft 365 사용자 보기
이 문서는 Microsoft 365 Enterprise와 Office 365 Enterprise에 모두 적용됩니다.
Microsoft 365 조직의 사용자 계정에는 조직에서 사용할 수 있는 라이선스 계획에서 할당된 사용 가능한 라이선스가 일부 또는 전부 또는 전혀 없을 수 있습니다. Microsoft 365 PowerShell을 사용하여 조직에서 라이선스가 부여되고 허가되지 않은 사용자를 빠르게 찾을 수 있습니다.
Microsoft Graph PowerShell SDK 사용
라이선스 세부 정보를 포함한 사용자 속성을 읽으려면 User.Read.All 권한 범위 또는 '사용자 가져오기' Graph API 참조 페이지에 나열된 다른 권한 중 하나가 필요합니다.
테넌트에서 사용할 수 있는 라이선스를 읽으려면 Organization.Read.All 권한 범위가 필요합니다.
Connect-Graph -Scopes User.Read.All, Organization.Read.All
특정 사용자 계정의 라이선스 세부 정보를 보려면 다음 명령을 실행합니다.
Get-MgUserLicenseDetail -UserId "<user sign-in name (UPN)>"
예를 들어 다음과 같습니다.
Get-MgUserLicenseDetail -UserId "belindan@litwareinc.com"
라이선스 계획(허가되지 않은 사용자)이 할당되지 않은 조직의 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.
Get-MgUser -Filter 'assignedLicenses/$count eq 0' -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All
Write-Host "Found $unlicensedUserCount unlicensed users."
라이선스 계획(허가되지 않은 사용자)이 할당되지 않은 조직의 모든 구성원 사용자 계정(게스트 제외) 목록을 보려면 다음 명령을 실행합니다.
Get-MgUser -Filter "assignedLicenses/`$count eq 0 and userType eq 'Member'" -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All
Write-Host "Found $unlicensedUserCount unlicensed users (excluding guests)."
라이선스 계획(라이선스가 부여된 사용자)이 할당된 조직의 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.
Get-MgUser -Filter 'assignedLicenses/$count ne 0' -ConsistencyLevel eventual -CountVariable licensedUserCount -All -Select UserPrincipalName,DisplayName,AssignedLicenses | Format-Table -Property UserPrincipalName,DisplayName,AssignedLicenses
Write-Host "Found $licensedUserCount licensed users."
E5 라이선스가 할당된 조직의 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.
$e5Sku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'SPE_E5'
Get-MgUser -Filter "assignedLicenses/any(x:x/skuId eq $($e5sku.SkuId) )" -ConsistencyLevel eventual -CountVariable e5licensedUserCount -All
Write-Host "Found $e5licensedUserCount E5 licensed users."
Graph 모듈용 Azure Active Directory PowerShell 사용하기
라이선스 계획(허가되지 않은 사용자)이 할당되지 않은 조직의 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.
Get-AzureAdUser | ForEach{ $licensed=$False ; For ($i=0; $i -le ($_.AssignedLicenses | Measure).Count ; $i++) { If( [string]::IsNullOrEmpty( $_.AssignedLicenses[$i].SkuId ) -ne $True) { $licensed=$true } } ; If( $licensed -eq $false) { Write-Host $_.UserPrincipalName} }
라이선스 계획(라이선스가 부여된 사용자)이 할당된 조직의 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.
Get-AzureAdUser | ForEach { $licensed=$False ; For ($i=0; $i -le ($_.AssignedLicenses | Measure).Count ; $i++) { If( [string]::IsNullOrEmpty( $_.AssignedLicenses[$i].SkuId ) -ne $True) { $licensed=$true } } ; If( $licensed -eq $true) { Write-Host $_.UserPrincipalName} }
참고
구독의 모든 사용자를 나열하려면 이 명령을 사용합니다 Get-AzureAdUser -All $true .
Windows PowerShell용 Microsoft Azure Active Directory 모듈 사용하기
조직의 모든 사용자 계정 및 라이선스 상태 목록을 보려면 PowerShell에서 다음 명령을 실행합니다.
Get-MsolUser -All
참고
PowerShell Core는 Windows PowerShell용 Microsoft Azure Active Directory 모듈 및 이름에 Msol 이 있는 cmdlet을 지원하지 않습니다. 이러한 cmdlet을 계속 사용하려면 Windows PowerShell에서 이를 실행해야 합니다.
조직의 모든 허가 되지 않은 사용자 계정 목록을 보려면 다음 명령을 실행 합니다.
Get-MsolUser -All -UnlicensedUsersOnly
전체 목록을 보려면 다음 명령을 실행 하 여 조직에 있는 사용자 계정의 라이센스:
Get-MsolUser -All | where {$_.isLicensed -eq $true}