SharePoint Online: PowerShell as Headache Reducer

Busby Berkley

Collaboration is beautiful.

When we collaborate, we accomplish miraculous things such as building pyramidssending robots to distant planets, staging intricately choreographed musical numbers or simply working together a little more efficiently.

Perhaps this is why SharePoint Online – a key part of the Office 365 suite – is popular.

By now, we all should be familiar with the sorts of things you can do with SharePoint such as:

  • Create sites for team collaboration
  • Build workflows to automate business processes
  • Create business intelligence portals

and much more…

There are two ways to manage SharePoint Online (SPO hereafter)which is SharePoint 2013:

  • Using the Office 365 Portal Administration Interface
  • Using PowerShell

If you’ve spent even a little time at this site, you’ve probably guessed that my preference is for PowerShell.

The reason is simple: fewer moving parts.

Consider the web portal:

sharepoint-portal-monroelab

 

Voila, a typical SPO admin portal (uh oh, looks like I may need to add more storage to my test environment but that’s a story for another time).

From here you can create new site collections, edit sites, assign administrative roles, modify the look and behavior of sites and many other things.

It’s a good interface; relatively straightforward – although not entirely intuitive (although to be fair, I’m not sure how intuitive it can be considering the application’s complex feature-set).

This is certainly a good management tool for making and controlling SPO sites.

The trouble is, sometimes the interface – or rather – the idiosyncrasies of the browser you use to control it – can create headaches that take you away from your actual goal of performing SharePoint administrative tasks.

To remove the browser from the process, I use PowerShell.

 

How to Login to SharePoint Online via Remote PowerShell

The cmdlet index for SharePoint Online isn’t as extensive as what’s available for Exchange or Skype for Business. Even so, it’s possible to perform all the basic functions of creating, modifying and deleting site collections, making it a very useful tool.

To run the SharePoint Online cmdlets, you’ll first need to download the SharePoint Online Management Shell which, as of this writing, is available at this link.

Once you’ve installed the management shell you can login to SharePoint online from your PowerShell session (launched as administrator) by running:

Connect-SPOService -Url https://yourdomain-admin.sharepoint.com -credential your-office365-admin-account@yourdomain.com

Note that your login account must possess global administrator privileges or at least SharePoint admin privs to use these commands.

Also note that the URL for your SPO admin site isn’t https://yourdomain.sharepoint.com (a common mistake) but https://yourdomain-admin.sharepoint.com.

You’ll be prompted to provide your tenant credentials:

sharepoint-monroelab-powershell-login-4

Once you’ve logged in, you’ll be able to issue cmdlets such as Get-SPOSite (which lists all currently running site collections):

get-sposite-monroelab

You can see a full list of SharePoint Online cmdlets by going here.

Of course, your opinion may vary; that’s why we live in such an exciting world full of clashing swords (both real and rhetorical).

In my experience, managing SharePoint Online with PowerShell simplifies the SPO administrative part of my life considerably.

 

 

 

 

 

 

Published by

D. Roberto

No one can know everything...but I come close! Actually, this project is an enhanced version of the notes I take everyday to sharpen my skills and deepen my understanding. Hopefully, it can be of some benefit to my fellow specialists around the world.