SharePoint Online Management Shell is a command-line utility that helps admins and developers to interact with SharePoint sites without Graphical User Interfaces (GUI). This will allow the users to perform automation tasks such as
- Monitoring the sites for unique permissions
- Monitoring the site classification
- Adding/removing site collection administrators
- Creating team sites
- Getting the site usage
- Getting the site users
- And much more.
At first if no SharePoint module has been installed, when connecting to SPO service you might be getting error similar to below.
Steps
There are 2 ways you can install the SharePoint Online Management shell.
- By downloading the exe file from the MSFT link and then running the exe file and follow the on-screen commands.
- By running the PowerShell (with version >5 or newer) command and then follow the prompts on the screen.
In this article, we will look into both PowerShell way and Installer file.
Using Installer file
This is simple and pretty straightforward. Prashant has written detailed steps on how to do it. Please go through the link ‘how to install SharePoint online management shell’ from the references section.
Using PowerShell
For the PowerShell you just have to run the below one line in the PS script pane
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
You might be getting below prompts.
- At first it needs to have NuGet manager to manage NuGet package repositories and download the required dependencies. It is similar to opening visual studio and using ‘NuGet package manager’ to download and install the required dependencies for successful execution.
Select ‘Yes’.
After that you might be getting below message 'you are installing from untrusted repository'.
Since the ‘PS Gallery’ is maintained by MSFT you can select ‘Yes’
Step 2
Validate the installation by running the below command. This will check the version of SharePoint online management shell.
Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version
Updating to the Latest version
For updating to the latest version in the PowerShell command window just enter the below one line script.
Update-Module -Name Microsoft.Online.SharePoint.PowerShell
Issues
If you are getting an issue similar to below, try running the Powershell as admin and execute the command, or add the parameter ‘-scope currentuser’.
References