Hi, here I’m sharing with you a PowerShell script that can help you if you are working on Office 365.
If ever, you asked yourself one day, how to quickly view the Office 365 licenses configuration for a group of users in your organization, here is a script that can help you achieve that goal.
How does it work :
Step 1 : Connect to Office 365 PowerShell using your Office 365 Admin account. Here is a tuto for that : https://docs.microsoft.com/fr-fr/office365/enterprise/powershell/connect-to-office-365-powershell
Step 2 : Prepare the upns csv file
Open a .txt file and fill it with your users UserPrincipalNames like this :
UserPrincipalName user1@domain.com user2@domain.com user2@domain.com user2@domain.com
Once you are done, save the content as a .csv file.
Step 3 : When your are connected, Copy and pass the below script in your console, and press Enter.
Function Show-LicensesMatrix { [CmdLetBinding()] Param( [Parameter(mandatory=$false)]$upnPath = "C:\Scripts\upns.csv" ) #License Plans correspondence table $LicensePlans = @{ E1 = "kingo:STANDARDPACK" E3 = "kingo:ENTERPRISEPACK" E5 = "kingo:ENTERPRISEPREMIUM" OD = "kingo:WACONEDRIVESTANDARD" } $Us = @() $Users = Import-Csv $upnPath | % {Get-MsolUser -SearchString $_.userPrincipalName} ForEach ($u in $Users) { #Initializing variables $E1 = $E3 = $E5 = $OD = $false #Getting user License Plans if ($u.Licenses.AccountSkuId -contains $LicensePlans.E1){$E1 = $true} if ($u.Licenses.AccountSkuId -contains $LicensePlans.E3){$E3 = $true} if ($u.Licenses.AccountSkuId -contains $LicensePlans.E5){$E5 = $true} if ($u.Licenses.AccountSkuId -contains $LicensePlans.OD){$OD = $true} $Us += New-Object -TypeName PSObject -Property @{ UserPrincipalName = $u.userPrincipalName E1 = $E1 E3 = $E3 E5 = $E5 OD = $OD } } $Us | ft userPrincipalName, E1,E3,E5,OD }
You are ready, run the script now :
The result will look like below :
The meaning of E1, E3, E5 and OD is :
- E1 : Office 365 Enterprise E1
- E3 : Office 365 Enterprise E3
- E5 : Office 365 Enterprise E5
- OD : OneDrive Entreprise (Plan 1)
“kingo” : refer to the name of my Office 365 tenant : kingo.onmicrosoft.com
Et voilà… 🙂
Right here is the perfect site for everyone who wishes to
find out about this topic. You know so much its almost hard to argue with you (not
that I personally will need to…HaHa). You definitely put a fresh
spin on a topic which has been discussed for a long time.
Wonderful stuff, just great!
LikeLike