Monitoring Sharepoint Online storage with Powershell

Monitoring Sharepoint Online storage with Powershell

Monitoring Sharepoint Online giving you a headache?


Fancy a Powershell script that’ll do it for you- AND alert at a defined threshold??


Regardless, I’ve done it anyway!!

Whether your managing an internal instance or managing a Sharepoint Online site for a customer, it can be tricky monitoring your quotas.

Fear not, here’s a simple Powershell script to keep an eye on things for you, and it will even send you an email if free space drops below the threshold you set.

Now this script assumes that you’ve already installed the Sharepoint Online Management Shell which includes the necessary Powershell modules but if you haven’t, grab it here.

The script currently requires you to set up some credentials securely in a txt file in order to be able to use them to connect to the admin instance of your Sharepoint online tenant, you’ll need to do this on the same machine you want to run the monitoring script from.  To do this, enter the following:

Then enter your password.

The file you output the credentials to is referenced in the script, so make sure if you change the name above then make the same change to the file name in the script.

So here’s the script.  You’ll need to change the $spourl and $user variables to your SPO Admin URL and admin user account respectively.  You’ll also need to change the $spositecollection object to that of your standard SPO site URL and change the From/To of the email alert to whatever you choose, and the SMTPServer to that of your mail server.

Enjoy and I hope it proves useful- set by default to alert when free space drops below 5GB but you can tailor this as required.  Set it to run as a scheduled task at your desired frequency and relax!

 

vM

Related posts