Skip to content
Uses a Powershell script to generate an Excel report of used licenses in Office 365 and mail it.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes 💥🐫 Added .gitattributes Apr 19, 2016
Send-O365PsLicenseReport.ps1 Remove redundant code Jul 28, 2016
licenses.xml Separated licenses from the script. Apr 27, 2016
licenses_config.xml Separated licenses from the script. Apr 27, 2016 Separated licenses from the script. Apr 27, 2016


This will generate an Excel report of all active licenses in your Office 365 and then mail it to the specified e-mail address.


This was initially made for a client who wanted a weekly report. To reduce time spent on generating a report. I created this Powershell script to automate the process. This is only meant for use with Project Server, but the filter can also be removed to include all Office 365 licenses.





Here is a list of parameter the script takes.

Parameter Required Default value Example Description
-O365Username Yes / Office 365 username, requires authorization to read licenses
-O365Password Yes / yourpassword Office 365 password
-FilePrefix No prefix prefix Prefix for the file generated.
-RunDir Yes / C:\path\to\file\out Directory where the report file will be saved. This is also the location of licenses_config.xml.
-MailSender Yes / E-mail the report file will be sent with.
-MailPassword Yes / yourpassword Password of the e-mail you'll be using to send the e-mail.
-MailSmtpServer Yes SMTP server
-MailSmtpPort No 587 587 SMTP port
-MailRecipients Yes /, Recipients
-MailCc No / E-mails in CC
-All No 0 1 Use value '1' to retrieve all licenses, or leave default '0' to use licenses_config.xml.

Example: Powershell.exe -Command "& C:\path\to\script\Send-O365PsLicenseReport.ps1 -O365Username '' -O365Password 'yourpassword' -FilePrefix 'prefix' -RunDir 'C:\path\to\file\out' -MailSender '' -MailPassword 'yourpassword' -MailRecipients '', '' -MailCc ''"

Note: The debugging settings section in the script can still be edited if desired.


This is a XML file, add licenses you wish to include in the report by coping the SKU part number. See the example licenses_config.xml file in the repository.

The licenses_config.xml file must be moved to the directory specified in the '-RunDir' parameter.

Task Scheduler (optional)

Now let's schedule the script.

  1. Open the Task Scheduler in Windows or Windows Server.
  2. Right-click Task Scheduler (local) in the left pane.
  3. Select Create Task.
  4. Give it a meaningful name.
  5. Select a user, preferably one that has permissions to save the Excel file to the path you entered in the script.
  6. Tick the radio button Run whether the user is logged in or not.
  7. In the Triggers tab, enter the desired trigger.
  8. In the Actions tab, make sure Start a program is selected in the Action combobox.
  9. Click the Browse button and select the Powershell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  10. Then in the Add arguments text box enter: -Command "& C:\path\to\script\Send-O365PsLicenseReport.ps1 -O365Username '' -O365Password 'yourpassword' -FilePrefix 'prefix' -RunDir 'C:\path\to\file\out' -MailSender '' -MailPassword 'yourpassword' -MailRecipients '', '' -MailCc ''"


Jonas Hendrickx


MIT License

You can’t perform that action at this time.