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
Import-Module Microsoft.Online.SharePoint.Powershell
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.
$spourl = “https://contoso-admin.sharepoint.com”
connect-sposervice -url $spourl
List all Site Collections
get-sposite
Get current storage of site collection
First we are going to get the Site Collection and request the information the current storage usage.
$spositecollection = get-sposite https://contoso.sharepoint.com
$spositecollection.StorageUsageCurrent
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.
#Gets the number of sites
$getnumberofsites = Get-SPOSite
$numbersofsites = $getnumberofsites.count
#get the storage quota for your tenancy
$gettenancy = Get-SPOTenant
$storagequota = $gettenancy.StorageQuota
#set average
$average = $storagequota / $numbersofsites
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.
Great Stuff.. Thanks for sharing.
sorry this does not work with wave 15 of office 365 anyomre…
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.
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
Hi Diany,
Take a look at these powershell command that have been written for the community. These should help you get what you want.
http://blog.falchionconsulting.com/index.php/downloads/
Alex