Freigeben über


Office 365 Script: Get an Office 365 user statistics report

Need a way to report mailbox statistics and/or mobile device usage information (plus a few other things) to your various business groups or subsidiaries? Or, perhaps you want to verify that users have been assigned the correct license? Use the following script to generate a little report – or big report if you have several thousands of users. In order for the script to work, you will need to download and install the Microsoft Online Services Module for Windows PowerShell. Keep in mind that the script can take a while to run across the internet against Office 365 if you have several thousands of users.

Read the help information for details on how to execute the script.

Get-help .\GetMsolUserReport.ps1 -full

A copy of the script can be downloaded by clicking on the link below.

 

UPDATED 09/07/2012 

- fixed a couple of typo's resulting from the previous update

UPDATED 08/17/2012

- fixed an issue where the script would throw an error about variable optimization when run using PowerShell v3 pre-release.

UPDATED 05/07/2012

- fixed an issue where department, company, and manager attribute values were not being saved to the file.  Thanks for pointing this out!

GetMsolUserReport.ps1

Comments

  • Anonymous
    January 01, 2003
    This is a great script.  Very similar to our Office 365 Reports software. Jude, this script does not write any info to your Office 365 environment. You should publish it on GITHub for people like Michel-v-V to make additions and improvements.

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Lars, thanks for pointing this out.  I must have deleted the lines that collected the department, company, and manager attributes when I was cleaning up commented out lines and stuff.  Those attribute values now appear in the report.  Thanks again!

  • Anonymous
    January 01, 2003
    Jude, Looks like I am able to repro the issue under powershell 3.  Will work on updating the script to prevent the error.  Thanks for bringing it to my attention!   For everyone else, if you have a powershell 2 system handy, please run the script under ps2.  thanks all!

  • Anonymous
    April 11, 2012
    This script is AWESOME!!!!  Thanks for sharing!

  • Anonymous
    April 25, 2012
    Great work Thomas!

  • Anonymous
    May 01, 2012
    Very nice Thomas!!!

  • Anonymous
    May 07, 2012
    Great script! It did however not export the department attribute for any of the AD accounts from one of my largests clients, so I cannot sort the output? :-( Can this be because of throttling (it's a large tenant)? If so, how do I solve this?

  • Anonymous
    May 18, 2012
    Hi, When i run the script, I'm getting the following error. Any ideas on why ?


Cannot overwrite variable strSecondaryProxyAddresses because the variable has been optimized. Try using the New-Variable or Set-Variable cmdlet (without any aliases) or dot the command trying to set the variable. At C:UsersJudeDownloadsGetMsolUserReport.ps1:948 char:45

  •             [string]$strSecondaryProxyAddresses += $($_.substring(5)) + ";"
  •                                                      ~~~~~~~~~~~~~~~    + CategoryInfo          : WriteError: (strSecondaryProxyAddresses:String) [], SessionStateUnauthorizedAccessExcept   ion    + FullyQualifiedErrorId : VariableNotWritableRare

And, I just want to know, by running the script, does it 'write' any info to the Office 365 environment ? TIA