SharePoint Management Shell is a Windows PowerShell module, which 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.
Let’s look for the system requirements to avoid any frustrating compatibility issues that might arise later.
System requirement
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
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 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 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 SharePoint Online Services (assuming the user has valid SharePoint Online account credentials)
$userCredentials = Get-Credential
Import Microsoft.Online.SharePoint.PowerShell Powershell module to Management Shell Console.
Import-Module Microsoft.Online.SharePoint.PowerShell
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, which I have supplied to the URL Parameter in the above command is the one, which you will find when admin is added in the URL.
Actually the 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 the URL in order to connect to SharePoint Online Services.
Due to this we have to specify https://prashantmbansal-admin.sharepoint.com as Tenant URL.
If we forgot to follow this convention, we might encounter the error given below.
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 SharePoint sites available within current tenancy by using the command given below.
Get-SPOSite
This is just the first step to start with PowerShell Development for SharePoint Online Sites, but the possibilities are limitless; especially when we can combine SharePoint Client Object Model with PowerShell Scripting Environment.
Hope, you find it helpful.