Office 365 SharePoint Online Admin PowerShell Cmdlet – With Samples

Standard

Office 365 and SharePoint Online is an ever growing and evolving cloud service  from Microsoft and in the migration to wave 15 of the Office product, Microsoft have released a set of PowerShell commands to manage your SharePoint Admin console.

Its important to note that these PowerShell commands are not the normal PowerShell commands you get for on-premise SharePoint and they are here to manage creating and managing site collection as well as gather information about your tenancy.

 

You can download the powershell commands from here

Here are a few powershell commands that you might find useful.

Import SharePoint Online Module


Use this cmdlet to add the commands for SHarePoint Online management shell

Connection to SharePoint Online

We are first going to set the URL of the SharePoint Online Admin site and then log in.

Note we only have powershell for the admin portal so you have to connect to the –admin.sharepoint.com URL.




 

List all Site Collections


Get current storage of site collection

First we are going to get the Site Collection and request the information the current storage usage.




Average out Storage Quota to all Site Collections

This last command is a little bit more complicated.

We are going to get the storage quota for the tenancy and then divide that by the number of site collections we have an implement it to each site.  This command can take a while to run as it will run on each site collection, confirm and then move onto the next one.








 







 





Get-SPOSite | foreach {Set-SPOSite -Identity $_.Url -StorageQuota $average}

This will now set each site collection to the average of the tenancy storage quota.  It will error if the average is over 100GB as this is the highest it can be.

5 thoughts on “Office 365 SharePoint Online Admin PowerShell Cmdlet – With Samples

    • A Pearce

      David,
      I would interested in hearing your experience as I haven’t seen any issues with Wave 15 and if anything they added more features with the tenancy is the wave 15 level.

  1. diany

    Hi Alex,

    Do you know if there is an option to get the document library size and # items for all users on SharePoint Online using powershell?

    thanks,
    Diany

Leave a Reply

Your email address will not be published. Required fields are marked *