MS documentation for this: Assign Microsoft 365 licenses to user accounts with PowerShell
The commands I mostly commonly use are:
Get-MsolAccountSku
Get-MsolUser -All -UnlicensedUsersOnly
Get-MsolUser -All | Set-MsolUser -UsageLocation US
To assign a license to one user:
Set-MsolUserLicense -UserPrincipalName "[email protected]" -AddLicenses "reseller-account:O365_BUSINESS_PREMIUM"
To assign a license to all unlicensed users:
Get-MsolUser -All -UnlicensedUsersOnly | Set-MsolUserLicense -AddLicenses "litwareinc:ENTERPRISEPACK"
Jason works as a project specialist at an IT MSP in Pennsylvania, USA. He’s an IT/security professional with 20 years experience.