Pull Office 365 Groups Site Usage Using Powershell

Office 365 groups is a wonderful tool for Ad Hoc Collaboration and is the backbone of Yammer groups and now Team as well.  The problem is that since end users can create them, they tend to explode in number and size and they count against your total quota for your tenant.  They also don’t show up in the SharePoint Admin interface so they can be hard to manage.  However, you can go grab them in Powershell.

First off, let’s see what we get from the Get-SPOSite command

This gives us a site and we can look at the properties for it.

Note the Template of GROUP#0, this will enable us to pull all of the groups by using the -Template switch on the Get-SPOSite cmdlet.

Once we do that we can simply grab the LastContentModifiedDate and the StorageUsageCurrent to see when it was last used and how much is stored in the site collection.  We can also use the WebsCount to see if they have created subsites as well.

So, the final code would look like this:

One thing that I have done here is to store everything in a HashTable to make exporting this to a CSV easier.  Then I can save that as an XLSX and format it as a table and then sort and filter it as needed.  Here is an example of what it looks like

Usage of Groups in a Tenant

Usage of Groups in a Tenant

Leave a Reply