以管理员身份运行AAD PS

image

查看订阅和使用状态

Get-MsolAccountSku

clip_image001

单个用户授予用户许可

clip_image003

Set-MsolUserLicense -UserPrincipalName "belindan@litwareinc.com" -AddLicenses "litwareinc:ENTERPRISEPACK"

批量授予所有用户许可

Get-MsolUser -All -UnlicensedUsersOnly | Set-MsolUserLicense -AddLicenses "qwew:ENTERPRISEPACK_NO_RMS"

clip_image005

删除单个用户许可

Set-MsolUserLicense -UserPrincipalName belindan@litwareinc.com -RemoveLicenses "litwareinc:ENTERPRISEPACK"

clip_image007

批量删除所有用户许可

$x = Get-MsolUser -All | where {$_.isLicensed -eq $true}; $x | foreach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "qwew:ENTERPRISEPACK_NO_RMS"}

clip_image009

查看未授权许可的用户

Get-MsolUser -All -UnlicensedUsersOnly

image

查看所有用户的许可分配状态

Get-MsolUser

image

isLicensed 属性值为False表示未分配许可,True表示已经分配许可