Get a list of users and which licenses they’ve got assigned.
First connect to the Microsoft Online environment.
# Import the MSOnline module. Import-Module MSOnline # Capture administrative credentials. $Credential = Get-Credential # Establishes Online Services connection to Azure Active Directory. Connect-MsolService -Credential $Credential
Run the script and find out which licenses they have.
# Get online users.
$MsolUsers = Get-MsolUser -All | Select-Object UserPrincipalName, Licenses, isLicensed
ForEach ($MsolUser in $MsolUsers){
if ($MsolUser.isLicensed -eq $True){
$LicencesAsText = $MsolUser.Licenses.AccountSkuId
Write-Host "$($MsolUser.UserPrincipalName) has license: $LicencesAsText" -BackgroundColor Green
}
}

Be First to Comment