As a growing topic in the SharePoint world, I thought I’d write a short series about the SharePoint Online Management Shell and highlight some of the more powerful ways you can get it working for you.

  1. Introduction (this post)
  2. Setup the PowerShell session
  3. Connecting and disconnecting to SPOnline
  4. Example: Enumerating Sites
  5. Example: Creating a SharePoint ClientContext
  6. Example: Re-Indexing a site
  7. Securing the password
  8. Putting it all together


I’ve come across many traditional SharePoint Admins who are reluctant to delve into the world of managing their SharePoint Online tenant through PowerShell. Most commonly, it’s simply down to a lack of confidence or understanding just how to get going. Of course, getting setup is easy enough, and Microsoft give us the process (see References) and it really couldn’t be easier. However, what can you do once you’ve connected to your SPO tenant? The PowerShell Command Builder (see References) gives us access to 33 cmdlets, varying from simple daily tasks (like adding and removing users, creating / deleting / restoring sites, etc) and some more one-off activities (such as upgrading sites, configuring the tenant, etc). Honestly though, it’s easy to get frustrated at how basic the functionality currently offered is, and while I’m confident Microsoft are busy working on improving them, for now anything above and beyond the basics will need to be done with a little more effort. There are (as always) a number of ways, but my favourite (and the one I’ll cover in this series) is combining the OOTB cmdlets with the ClientContext class (see References) to leverage the context of SharePoint objects and operations.

What I hope to achieve in this series is to provide the essentials of using the SharePoint Online Management Shell and help to build a “primer” script that you can re-use for all SPOnline activities via PowerShell.