List all OneDrive Sites V2 – HTML Report

This is the version two of my earlier script that I shared back in 2018.

New requirement came from one of our team is if we can show:

  • Storage sage of onedrive for user
  • Storage Quota assigned
  • Percentage of storage used.

Script will collect all the onedrive urls and save it in HTML table under report folder.

Download the script from Powershell gallery or from github.

Install-Script -Name ListAllOnedriveSItes

Once installed, you will be able to find the script in below location , you can run from there or copy it to some other location.
C:\Program Files\WindowsPowerShell\Scripts

Copy the script to the location you want and when you run it, it will create logs and report folder.

I am using onedrive site template as “SPSPERS#9” but I have seen in some tenants it is “SPSPERS#10”

Update the variable as per your environment.

$onedrivetemplate = “SPSPERS#9”

Once you will run the script it will ask you for the office 365 organization name and credentials for Sharepoint online administrator as shown below.

It will authenticate, generate the report and will save in the report folder.

For calculating percentage below powershell formula is used in the select statement.

@{L=‘Percentage Used’;E={“{0:N2}” -f (($_.StorageUsageCurrent/$_.StorageQuota)*100)}}

Report will look as below:

Thanks for reading and downloading

Tech Wizard


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s