As Microsoft MSOL Online module is being retired so we need to update our existing scripts, one of the scripts is office 365 License report that uses this module to extract license information and send Email summary of licenses along with full report saved on file share.
Prerequisites for this Solution:
Download the Script from Github:
Update the parameters inside the script (at the top)
Script has been coded with friendly license names at two places, which you can update and add new license names accordingly.
Now when you run the script or schedule it, it will send the email to the identity in $email1 variable and if there are any errors it will send to $erroremail variable.
Email will have summary of licenses as shown in the below snippet.
License file with full details will also get created and saved at the path defined in variable $output1.
For large tenants script can take ample amount of memory and can crash because of bug in powershell version 5.1 where it cannot go beyond 250 pages page depth.
Running in PowerShell version 7.x resolves the above issue.(to be run on server 2019, 2016 has bug for AD module on powershell 7.x)
I hope this code will assist you in getting the license details inside your tenants or if you are using my old script this script will replace it.
Thanks for reading and downloading…