Common CmdLets

#Microsoft 365 PowerShell Module 
Install-Module MSOnline
# Connect to 365 
Connect-MsolService 

#Set the license type for the userSet-MsolUserLicense -UserPrincipalName "Dawn@ScriptsbyScott.com" -AddLicenses "ScriptsbyScott:ENTERPRISEPACK"

#List all Users and Licnese and if Licesned
Get-MsolUser -All | select UserPrincipalName,Licenses,IsLicensed,OverallProvisioningStatus 

#Get Licnese Type & Count Summary
$customformat = @{expr={$_.AccountSkuID};label="AccountSkuId"},
         @{expr={$_.ActiveUnits};label="Total"},
         @{expr={$_.ConsumedUnits};label="Assigned"},
        @{expr={$_.activeunits-$_.consumedunits};label="Unassigned"},
        @{expr={$_.WarningUnits};label="Warning"}
Get-MsolAccountSku | sort activeunits -desc | select $customformat 

#Get Service Plan and Status
Get-MsolAccountSku | select -ExpandProperty ServiceStatus

#List all Azure AD Roles
Get-MSOlRole

#Assign a user to a role 
Add-MsolRoleMember -RoleName "Company Administrator" -RoleMemberEmailAddress "elisadaugherty@contoso.com"

License_Counter.PNG
MSOUser.PNG