SharePoint Management Shell is a Windows PowerShell Module that allows managing SharePoint Users, Sites & Content in an efficient manner.
In this article we will see the steps to setup the development machines with “SharePoint Online Management Shell”.
First let’s look for the System Requirements to avoid any frustrating compatibility issues that might arise later on:
Supported Operating System
- Windows 7 Service Pack 1
- Windows 8
- Windows Server 2008 R2 SP1
- Windows Server 2008 Service Pack 2
- Windows Server 2012
- PowerShell 3.0
Steps to Install SharePoint Online Management Shell
Step 1: Visit the Url: https://www.microsoft.com/en-in/download/details.aspx?id=35588
Step 2: Click download button
Step 3: Select “sharepointonlinemanagementshell_4727-1200_x64_en-us.msi” file and click Next
Step 4: Run the “sharepointonlinemanagementshell_4727-1200_x64_en-us.msi” file
Step 5: Accept License Terms & Click Install Button
Step 6: Once the installation is complete, search for “SharePoint Online Management Shell” and launch it
This completes the installation of SharePoint Online Management Shell on our machine.
Now let’s try a few of the operations to verify the installation of SharePoint Online PowerShell Module
How to connect to SharePoint Online Services
Get current user credentials to connect to the SharePoint Online Services (assuming the user is having a valid SharePoint Online Account Credentials)
$userCredentials = Get-Credential
Import “Microsoft.Online.SharePoint.PowerShell” Powershell module to the Management Shell Console
Connect to SharePoint Online Service by supplying Tenant Url and User Credential to the Connect-SPOService command
Connect-SPOService -Url https://prashantmbansal-admin.sharepoint.com -Credential $userCredentials
If you notice carefully the URL I have supplied to the Url Parameter in the above command, you will find “-admin” is added in the URL.
Actual URL of the Tenant is https://prashantmbansal.sharepoint.com but it is by convention that we much have to use “-admin” in the Host Header of URL in order to connect to the SharePoint Online Services.
That is why we have to specify the “https://prashantmbansal-admin.sharepoint.com” as Tenant URL.
If we forgot to follow this convention we might encounter the following error:
How to get the list of all the SharePoint Sites lies under current Tenancy
Once we are successfully able to Connect to SharePoint Online Services we can perform different operations on the site such as getting a list of all the SharePoint Sites available with in current tenancy by using the following command.
This is just the first step to Start with PowerShell Development for the SharePoint Online Sites, but the possibilities are limitless, especially when we can combine the SharePoint Client Object Model with PowerShell Scripting Environment.
We will explore the details on CSOM based Solutions driven by PowerShell Scripts in future articles.
Hope you find it helpful.