SharePoint Online Management Shell Explained

default post thumbnails

Can you believe SharePoint was first released in 2001? Fast forward fourteen years to today, and it’s hard to find an organization which doesn’t use the platform in some capacity.

According to the Association for Information and Information Management (AIIM) one in every two corporations worldwide uses SharePoint. In 22% of companies, almost all employees use Microsoft’s communications and collaboration platform.

SharePoint Is Like Soccer: It Needs a Manager

SharePoint Online Management Shell

Soccer club managers seem to spend their time shouting at players from the sidelines. As strange as this activity seems, it does serve a purpose. While individual players specialize in what they do best – whether it’s defence or attack – to be successful the team needs someone with an overview of what’s going on.

If you’re a SharePoint manager, don’t take this analogy to mean you can start shouting at your colleagues. Rather, you need to begin using the best tactics to make your SharePoint environment a success.

PowerShell for SharePoint Will Be Your ‘Right Hand Man’

SharePoint Online Management Shell

PowerShell is a highly effective and easy to use tool for managing SharePoint. Everything that can be done from SharePoint’s central administration can be done using PowerShell with much greater ease. PowerShell decreases the agony of menial tasks and helps you manage SharePoint consistently and reliably.

With SharePoint hosted on the cloud in Office 365, there have been very limited options for SharePoint administrators to use PowerShell. However, with the recently released SharePoint Online Management Shell, it’ll be easy to manage SharePoint Online from any remote computer.

Not every command is available in SharePoint Online compared with On-Premises, but it’s certainly a good start.

SharePoint Online Management Shell

SharePoint Online Management Shell is a Windows PowerShell module loaded with the SharePoint libraries for SharePoint Online, and is hosted on Office 365. It helps administrators to manage users, sites and site collections, and more.

To get started with SharePoint Online Management Shell, You can download and install the Shell here. The only prerequisites for the application is Windows PowerShell v3 or greater and .Net Framework.v4 or greater.

After a couple of minutes you will be all set up. Now go to All Programs and find and launch ‘SharePoint Online Management Shell’.

SharePoint Online Management Shell

You might run across the above error but running SharePoint in administrator mode should resolve the error.

Establish a Connection with SharePoint Online

Once the SharePoint Online Management Shell is installed, our next step is to establish a connection with your SharePoint online site. To establish the connection you can use the below commands.

The first command will prompt you to get the credentials of the SharePoint Admin Site and store it in the $sponlinecred variable. The second command will establish the connection with the SharePoint Admin site using the credentials supplied in $sponlinecred.

Once the connection is established, you can execute the SharePoint Online Management PowerShell commands on the site.

You can execute the below command to get the list of all the commands available for SharePoint Online Management Shell:

There is a great tool available from Microsoft to generate the PowerShell commands based on the verbs and noun actions of your required task over here. Generate the PowerShell command by setting the appropriate property and with the ‘Copy to clipboard’ action you can use that command in your PowerShell. You have to select the product type as ‘SharePoint Online’ under the products drop down.

SharePoint Online Management Shell

There are round about 30 cmdlets available for administering SharePoint Online and these can be categorized into the following categories:

  • User/Site Groups – Suffixed by *-SPOSiteGroup, all the commands under these categories allow you to create, set, get and remove site groups for the particular site collection
  • User Management – Suffixed by *-SPOUser, these commands deal with the management of users on the site collection. You can add, update and delete Office 365 users as well as external users
  • Site Collections Management – This set of cmdlets allows you to perform the crud operations for creation of site collections as well as restoring the deleted site collection or removing a site collection from the recycle bin
  • Tenants – The cmdlets under these categories deal with tenant information like Storage quota size, storage allocated quota, resource quota size, company logs, etc.
  • Apps – There are only 2 cmdlets Get-SPOAppErrors and Get-SPOAppInfo available under these section which provides us all the application errors and all the installed applications available on the site respectively
  • Connections/Disconnection – The cmdlets available under these categories help you establish the connection with your SharePoint online site as well as to disconnect the session

How does it work?

Behind the scenes, SharePoint Online Management Shell uses the SharePoint Client Object Model to retrieve the required output. It sends the request in XML format to the lists.asmx service in SharePoint.

Below is the fiddler trace for the execution of cmdlet ‘Get-SPOSite’ on the SharePoint Online management shell.

SharePoint Online Management Shell

It’s Not Easy Being a SharePoint Admin

SharePoint Online Management Shell

Being a SharePoint administrator is no easy task. Administrators receive numerous weird and wonderful queries from end users to help them manage the platform. Sometimes it can get seriously tedious for admins to perform the same tasks over and over again.

Without PowerShell to perform these steps, we’d have to manually repeat all the steps from the graphical user interface. Not only would this be waste of time and energy, we’d also be losing time which would be better spent elsewhere.

Although SharePoint Online Management Shell has a limited set of cmdlets, it’s a good start to make the job of managing users, site collections and groups easier. The release of SharePoint Online Management Shell is particularly useful where there is no server access and the admin has to rely on GUI administration.

PowerShell provides the best way of adopting automation for admin activities which are used on a day to day basis. Administrators can prepare a Shell of scripts for each admin task and whenever new tickets are raised, they can use that script directly from PowerShell. This means the administrator doesn’t have to log in to the SharePoint Admin and implement numerous steps which could be done with the single execution of script!

What did you think of this article?

Recommended by our team

Getting started is easy

Try ShareGate free for 15 days. No credit card required.

Gif Transparent

On-demand webinar Harmonize your SharePoint sites with Teams