Office 365 -SharePoint Online Administration – How Tos – Part 1 (Connection, Site collection cmdlets)

So, sites, collections, apps and workflows galore. What now? Administration!

When there are a lot of workflows in a site associated with site contents(list/library) it becomes difficult to manage the site(collections). You as an administrator will NEED a quick and automated way to find out what is going on with your site contents. Check the status of your workflows without having to do the click, click, click and click some more! UI is great but not when you are handling a big collection and want to get results quickly on what list/library item workflows are successfully completed and which ones were suspended/terminated in your collection, PowerShell and SPOnline cmdlets is your friend.

You can definitely look at individual item > … > Workflows > Click on Status and if you are diligently logging help texts to your workflow history list upon completion of an action block in your workflow, you can troubleshoot there. But imagine a list with 100’s of items in it. Its a waste of resource and time to go through it all manually. In comes SP Online Management Shell and CSOM to rescue.

Intro to SP Online Management for Office 365:
There are around 42 windows PowerShell for SharePoint Online cmdlets. To get a list of ALL the SPOnline Powershell commands Select SharePoint Online Management  Shell(a tool that has Windows PowerShell Module to manage your SharePoint Online tenant. You MUST have SPOnline admin credentials to use the tool)

In addition to this tool to enable development against your SharePoint online sites you can get SharePoint Online Client Components SDK This installs a list of dlls to your C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI directory. You can use these to talk to your subsite contents and manage the sites via a combination of PowerShell and CSOM commands.


To export any of the outputs of the cmdlets to a .csv file simply add | Export-CSV –path MyReport.csv  to the command and result set will be exported to csv file. You can open the same in Excel.

Connection Cmdlets: Two commands that manage your connections to SharePoint Online tenant are
1. Connect-SPOService
    Enter your administrator login/password and sign in. This cmdlet stores Microsoft.SharePoint.Client.ClientContext object in an internal variable.
2. Disconnect-SPOService (disconnects previously created sharepoint online service connection)
Get-Command Module Microsoft.Online.SharePoint.Powershell (to retrieve list of ALL SPOnline cmdlets you have)

Note: Once in  your SPOnline management shell to change directory eg. c:\powershell\scripts type
Set-Location c:\powershell\scripts (this changes your location as desired. If your folder has blank spaces in between like C:\this or that then type Set-Location C:\this` or` that)
dir (shows all the files in the directory)

Site Collection cmdlets:
Noun: Site
Available Verbs: Get, New, Set, Test, Upgrade, Repair, Remove
3. Get-SPOSite -Limit ALL -Detailed (lists all site collections in your tenant. By default Get-SPOSite returns up to only 200 sites. Using -Limit All gets us all of them. -Detailed shows ALL values in properties)
4. New-SPOSite -Url -owner -storagequota 100 -nowait – resourcequota 50 -template STS#0 -timezone 10 -compatibilitylevel 15(creates a new SharePoint online site collection with storage quota 100MB, resource quota 50MB without any delay. Time zone 10 stands for EST, compatibility level is set for SharePoint 2013(15),  If there is a deleted site with the same name in recycle bin, this command will fail)
Checkout list of all MS SharePoint available options for properties in links/lists below:
ID Time Zone
2 (GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
3 (GMT+01:00) Brussels, Copenhagen, Madrid, Paris
4 (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
5 (GMT+02:00) Athens, Bucharest, Istanbul
6 (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
7 (GMT+02:00) Minsk
8 (GMT-03:00) Brasilia
9 (GMT-04:00) Atlantic Time (Canada)
10 (GMT-05:00) Eastern Time (US and Canada)
11 (GMT-06:00) Central Time (US and Canada)
12 (GMT-07:00) Mountain Time (US and Canada)
13 (GMT-08:00) Pacific Time (US and Canada)
14 (GMT-09:00) Alaska
15 (GMT-10:00) Hawaii
16 (GMT-11:00) Midway Island, Samoa
17 (GMT+12:00) Auckland, Wellington
18 (GMT+10:00) Brisbane
19 (GMT+09:30) Adelaide
20 (GMT+09:00) Osaka, Sapporo, Tokyo
21 (GMT+08:00) Kuala Lumpur, Singapore
22 (GMT+07:00) Bangkok, Hanoi, Jakarta
23 (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi
24 (GMT+04:00) Abu Dhabi, Muscat
25 (GMT+03:30) Tehran
26 (GMT+03:00) Baghdad
27 (GMT+02:00) Jerusalem
28 (GMT-03:30) Newfoundland
29 (GMT-01:00) Azores
30 (GMT-02:00) Mid-Atlantic
31 (GMT) Casablanca, Monrovia, Reykjavik
32 (GMT-03:00) Buenos Aires, Georgetown
33 (GMT-04:00) Caracas, La Paz
34 (GMT-05:00) Indiana (East)
35 (GMT-05:00) Bogota, Lima, Quito, Rio Branco
36 (GMT-06:00) Saskatchewan
37 (GMT-06:00) Guadalajara, Mexico City, Monterrey
38 (GMT-07:00) Arizona
39 (GMT-12:00) International Date Line West
40 (GMT+12:00) Fiji Is., Kamchatka, Marshall Is.
41 (GMT+11:00) Magadan, Solomon Is., New Caledonia
42c(GMT+10:00) Hobart
43 (GMT+10:00) Guam, Port Moresby
44 (GMT+09:30) Darwin
45 (GMT+08:00) Beijing, Chongqing, Hong Kong S.A.R., Urumqi
46 (GMT+06:00) Almaty, Novosibirsk
47 (GMT+05:00) Islamabad, Karachi, Tashkent
48 (GMT+04:30) Kabul
49 (GMT+02:00) Cairo
50 (GMT+02:00) Harare, Pretoria
51 (GMT+03:00) Moscow, St. Petersburg, Volgograd
53 (GMT-01:00) Cape Verde Is.
54 (GMT+04:00) Baku
55 (GMT-06:00) Central America
56 (GMT+03:00) Nairobi
57 (GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb
58 (GMT+05:00) Ekaterinburg
59 (GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
60 (GMT-03:00) Greenland
61 (GMT+06:30) Yangon (Rangoon)
62 (GMT+05:45) Kathmandu
63 (GMT+08:00) Irkutsk, Ulaan Bataar
64 (GMT+07:00) Krasnoyarsk
65 (GMT-04:00) Santiago
66 (GMT+05:30) Sri Jayawardenepura
67 (GMT+13:00) Nuku’alofa
68 (GMT+10:00) Vladivostok
69 (GMT+01:00) West Central Africa
70 (GMT+09:00) Yakutsk
71 (GMT+06:00) Astana, Dhaka
72 (GMT+09:00) Seoul
73 (GMT+08:00) Perth
74 (GMT+03:00) Kuwait, Riyadh
75 (GMT+08:00) Taipei
76 (GMT+10:00) Canberra, Melbourne, Sydney
77 (GMT-07:00) Chihuahua, La Paz, Mazatlan
78 (GMT-08:00) Tijuana, Baja California
79 (GMT+02:00) Amman
80 (GMT+02:00) Beirut
81 (GMT-04:00) Manaus
82 (GMT+03:00) Tbilisi
83 (GMT+02:00) Windhoek
84 (GMT+04:00) Yerevan
ID TimeZone


  • STS#0   Team Site
  • STS#1   Blank Site
  • STS#2   Document Workspace
  • MPS#0   Basic Meeting Workspace
  • MPS#1   Blank Meeting Workspace
  • MPS#2   Decision Meeting Workspace
  • MPS#3   Social Meeting Workspace
  • MPS#4   Multipage Meeting Workspace
  • BLOG#0   Blog
  • SGS#0   Basic Group Work Site
  • SGS#1   Blank Group Work Site
  • WIKI#0   Wiki

5. Set-SPOsite -Identity -ResourceQuota 100 -StorageQuota 200 -DisableSharingForNonOwners
To update/set a site based on various properties use Set verb followed by required properties. The above command updates the resource, storage quotas and disables sharing by users who are NOT owners of the site acollection.

6. Test the site by using the command Test-sposite


7.Repair the site by using Repair -SPOSite

8. Remove-SPOSite Note, I was not the owner of the site, so this failed initially. Once I made admin account owner of the site collection, this command worked
9. Restore-SPODeletedSite restores deleted site from recyclebin.
10. Remove-SPODeletedSite‘ removes the deleted site from Recycle Bin.
11. Get-SPODeletedSite -IncludePersonalSite gets the list of all deleted sites including personal sites.
12. Request SPOPersonalSite requests personal site be created for user with given email ids. These are queued and will be created by timer job later. Limits: 1-200
Request-SPOPersonalSite -UserEmails $emails -NoWait
12. Upgrade-SPOSite -Identity -VersionUpgrade command upgrades the version of the SharePoint Online site collection to SP 2013
13. Request-SPOUpgradeEvaluationSite requests that a SPOnline gloabal admin request a copy of the site collection for validation post upgrade.
Following posts in the make as part of this how-to series:
– Remaining cmdlets
– Workflow Status check scripts

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 )

Google+ photo

You are commenting using your Google+ 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