PowerShell을 사용하여 라이선스 및 허가되지 않은 Microsoft 365 사용자 보기

이 문서는 Microsoft 365 Enterprise와 Office 365 Enterprise에 모두 적용됩니다.

Microsoft 365 organization 사용자 계정에는 organization 사용할 수 있는 라이선스 계획에서 할당된 사용 가능한 라이선스가 일부 또는 전부 또는 전혀 없을 수 있습니다. Microsoft 365용 PowerShell을 사용하여 organization 사용이 허가되고 허가되지 않은 사용자를 빠르게 찾을 수 있습니다.

참고

Azure Active Directory 모듈은 Microsoft Graph PowerShell SDK로 대체됩니다. Microsoft Graph PowerShell SDK를 사용하여 모든 Microsoft Graph API에 액세스할 수 있습니다. 자세한 내용은 Microsoft Graph PowerShell SDK 시작하기를 참조하세요.

Microsoft Graph PowerShell SDK 사용

먼저 PowerShell을 사용하여 Microsoft 365에 연결합니다.

라이선스 세부 정보를 포함한 사용자 속성을 읽으려면 User.Read.All 권한 scope 또는 '사용자 가져오기' Graph API 참조 페이지에 나열된 다른 권한 중 하나가 필요합니다.

테넌트에서 사용할 수 있는 라이선스를 읽으려면 Organization.Read.All 권한 scope 필요합니다.

Connect-Graph -Scopes User.Read.All, Organization.Read.All

특정 사용자 계정의 라이선스 세부 정보를 보려면 다음 명령을 실행합니다.

Get-MgUserLicenseDetail -UserId "<user sign-in name (UPN)>"

예를 들면

Get-MgUserLicenseDetail -UserId "belindan@litwareinc.com"

라이선스 계획(허가되지 않은 사용자)이 할당되지 않은 organization 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.

Get-MgUser -Filter 'assignedLicenses/$count eq 0' -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All

Write-Host "Found $unlicensedUserCount unlicensed users."

라이선스 계획(허가되지 않은 사용자)이 할당되지 않은 organization 모든 멤버 사용자 계정(게스트 제외) 목록을 보려면 다음 명령을 실행합니다.

Get-MgUser -Filter "assignedLicenses/`$count eq 0 and userType eq 'Member'" -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All

Write-Host "Found $unlicensedUserCount unlicensed users (excluding guests)."

라이선스 계획(사용이 허가된 사용자)이 할당된 organization 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.

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 라이선스가 할당된 organization 모든 사용자 계정 목록을 보려면 다음 명령을 실행합니다.

$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."

참고 항목

PowerShell로 Microsoft 365 사용자 계정, 라이선스 및 그룹 관리

PowerShell로 Microsoft 365 관리

Microsoft 365 용 PowerShell 시작