Comments? Questions?

Have a look at my GitHub SharePointOnline-ScriptSamples, where you can find this SharePoint script and many others!

You can find all my repositories at PowershellScripts @ GitHub


The script retrieves all SPO users and pulls usage statistics for their ODB sites.


The script uses CSOM. It requires SharePoint Online SDK and SharePoint Online Management Shell. Make sure the script refers the paths on your computer:


# Paths to SDK. Please verify location on your computer. 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"  
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" 



How to use?

1. Download the script and open it in ISE or NotePad.

2. Enter your tenant's data:


$pass=Read-Host "Enter Password: " -AsSecureString 


3. Run the script.

4. Expected results:





The script is using Invoke-LoadMethod published here, without which it could not proceed. The method was created and belongs to a brilliant SharePointer and Guru, Vadim Gremyachev.