Office 365 SharePoint Online Management Shell

SharePoint Online is a subset of Office 365 which has come up with SharePoint Online Management Shell to run administrative commands from the command line. These cmdlets help manage the SharePoint Online users and sites.

SharePoint Online Management Shell is a Windows PowerShell module. To use cmdlets, a SharePoint Online site administrator must be a global administrator in Office 365.
 
SharePoint Online Management Shell can only be used by the SharePoint Online global administrators. This tool is helpful to remotely manage site collections, configure SharePoint Online company-level settings, upgrade site collections to a new version and get logs from data connections between SharePoint Online and other services through Business Connectivity Services.
 
First of all, you have to set up the environment for SharePoint Online Management Shell.
 

Set up SharePoint Online Management Shell environment

 
Please follow these below-mentioned steps to set up the SharePoint Online Management Shell environment.
 
Please download and install Windows Management Framework 3.0 from here - https://www.microsoft.com/en-us/download/details.aspx?id=34595
 
NOTE - Based on your environment, this installation may fail. So, just skip this installation error message if this installation is not suitable for your environment.
 
Please download and install SharePoint Online Management Shell from here https://www.microsoft.com/en-us/download/details.aspx?id=35588
 
After a successful installation, please open this app/tool from your installed gallery. You may pin it to the taskbar for using it in the future.
 
Please run this as “Run ISE as Administrator”.

 
Get-Help Section of Cmdlets

 
Now, please refer to this screenshot. Here, first, I am trying to get-help more about the command Connect-SPOService through this PS window. It has intelligence which would help you to locate the exact command you want to execute.
 
NOTE
You can use the Get-Command cmdlet to list all cmdlets, and use the Get-Help cmdlet to learn more about any cmdlet. For more information, see Get-Command and Get-Help.
 
Here, I have used the Get-Help cmdlet for Connect-SPOService.
 
Office 365 SharePoint Online Management Shell
 
For getting more information about a particular cmdlet, you can use these below-mentioned cmdlets.
 
To see the examples, type: “Get-Help Connect-SPOService -examples”.
For more information, type: “Get-Help Connect-SPOService -detailed”.
For technical information, type: “Get-Help Connect-SPOService -full”.
For online help, type: “Get-Help Connect-SPOService -online”
 
Get-Help Connect-SPOService – Examples -:
 
Office 365 SharePoint Online Management Shell
 
Get-Help Connect-SPOService – Full -:
 
Office 365 SharePoint Online Management Shell
 
Get-Help Connect-SPOService – Detailed -:
 
Office 365 SharePoint Online Management Shell
 
Here I have taken Connect-SPOService as an example. You can use the Get-Help command for any of the cmdlets present for SharePoint online.
 
NOTE
From these above-mentioned help commands, you can get proper information about the syntax of the cmdlet, examples on how you can build your command and which parameters are required to execute a particular cmdlet.
 
Now, I will show you have we can execute the actual Connect-SPOService cmdlet.
 
For example, type this command at the prompt,
 
Connect-SPOService -Url https:// softreeconsulting-admin.sharepoint.com -credential admin@softreeconsulting.com
URL is the URL of the SharePoint Online Administration Center
 
A credential is the user name to which you want to grant access to the SharePoint Online Administration Center site.
 

SharePoint Online Management Shell Cmdlets

 
There are many SharePoint online cmdlets available. In this following section, I have separated the cmdlets into mainly six categories and they are as mentioned below.
  • User management cmdlets
  • User group management cmdlets
  • Upgrade cmdlets
  • Site Collection management cmdlets
  • Service connection and disconnection cmdlets
  • Organization-level monitoring and management cmdlets
  • OneDrive sync for domains that are on the safe recipient's list
  • SharePoint Online and OneDrive Migration

User Management cmdlets

 
Cmdlet Name– Add-SPOuser
 
Description – Adds an existing Office 365 user or an Office 365 security group to a SharePoint group.
 
Examples
 
Add-SPOUser -Site https:// softreeconsulting.sharepoint.com -LoginName user1@softreeconsulting.com -Group “SoftreeConsulting Owners”
Cmdlet Name – Get-SPOUser
Descriptions– This returns the SharePoint Online user or security group accounts that match given search criteria.
 
Examples
 
Get-SPOUser -Site
https://softreeconsulting.sharepoint.com
This returns all user or security group accounts from the site collection http://softreeconsulting.sharepoint.com.
 
Get-SPOUser -Site
https://softreeconsulting.sharepoint.com -LoginName user2@softreeconsulting.com
This returns one user or security group account whose user name is HYPERLINK “mailto:user2@softreeconsulting.com”
user2@softreeconsulting.com from the site collection https://softreeconsulting.sharepoint.com.
 
Get-SPOUser -Site https://softreeconsulting.sharepoint.com -Group “Team Site Members”
This returns one user or security group account inside group Team Site Members from the site collection http://softreeconsulting.sharepoint.com.
 
Here in this below table, I have added all respective cmdlets available for all categories.

User Management cmdlets

User Management cmdlets Name Description
Add-SPOuser Adds an existing Office 365 user or an Office 365 security group to a SharePoint group.
Get-SPOUser Returns the SharePoint Online user or security group accounts that match given search criteria.
Remove-SPOUser Removes a user or a security group from a site collection or a group.
Set-SPOUser Configures properties on an existing user
Get-SPOExternalUser Returns external users that are located in the tenant’s folder based on specified criteria
Remove-SPOExternalUser Permanently removes a collection of external users from the tenant’s folder
Revoke-SPOUserSession Provides IT administrators the ability to sign out and invalidate a particular users’ sessions across all their devices

User Group management cmdlets

User group management cmdlets Descriptions
Get-SPOSiteGroup Gets all the groups on the specified site collection
New-SPOSiteGroup Creates a new group in a SharePoint Online site collection
Remove-SPOSiteGroup Removes a SharePoint Online group from a site collection
Set-SPOSiteGroup Updates the SharePoint Online owner and permission levels on a group inside a site collection

Upgrade cmdlets

Upgrade cmdlets Descriptions
Upgrade-SPOSite Starts the upgrade process on a site collection.
Request-SPOUpgradeEvaluationSite Requests creation of a copy of an existing site collection for the purposes of validating the effects of upgrade without affecting the original site

Site Collection management cmdlets

Site Collection management cmdlets Descriptions
Get-SPODeletedSite Returns all deleted site collections from the Recycle Bin
Remove-SPODeletedSite Removes a SharePoint Online deleted site collection from the Recycle Bin.
Restore-SPODeletedSite Restores a SharePoint Online deleted site collection from the Recycle Bin.
Get-SPOSite Returns one or more site collections.
New-SPOSite Creates a new SharePoint Online site collection for the current company.
Remove-SPOSite Sends a SharePoint Online site collection to the SharePoint Online Recycle Bin.
Repair-SPOSite Checks and repairs the site collection and its contents.
Set-SPOSite Sets or updates one or more properties’ values for a site collection.
Test-SPOSite Tests a SharePoint Online site collection.
Request-SPOPersonalSite Requests that one or more users be added to the queue for a Personal Site to be created

Service connection and disconnection cmdlets

Service connection and disconnection cmdlets Descriptions
Connect-SPOService Connects a SharePoint Online global administrator to a SharePoint Online connection; that is, connects the administrator to the SharePoint Online Administration Center. This cmdlet must be run before any other SharePoint Online cmdlets can run.
Disconnect-SPOService Disconnects from a SharePoint Online service.

Organization-level monitoring and management cmdlets

Organization-level monitoring and management cmdlets Descriptions
Get-SPOAppErrors Returns application errors.
Get-SPOAppInfo Returns all installed applications.
Get-SPOTenant Returns SharePoint Online organization properties.
Set-SPOTenant Sets properties on the SharePoint Online organization.
Get-SPOTenantLogEntry Retrieves SharePoint Online company logs.
Get-SPOTenantLogLastAvailableTimeInUtc Returns the time when the SharePoint Online organization logs are collected.
Get-SPOWebTemplate Displays all site templates that match the given identity.

OneDrive sync for domains that are on the safe

OneDrive sync for domains that are on the safe Descriptions
Get-SPOTenantSyncClientRestriction Returns the current configuration status
Remove-SPOTenantSyncClientRestriction Disables the feature for tenancy, but does not remove any present domain GUID entries from the safe sender-recipient list.
Set-SPOTenantSyncClientRestriction Enables the feature for the tenancy and permits you to set the domain GUIDs in safe recipients list.

SharePoint online and OndDrive Migration

SharePoint online and OndDrive Migration Description
ConvertTo-SPOMigrationTargetedPackage Re-maps a previously created file share based package or exported SharePoint package to accurately describe objects in a target web.
New-SPOMigrationPackage Creates a new migration package based on source files in a local or network shared folder.
Set-SPOMigrationPackageAzureSource Creates Azure containers, upload migration package files into the appropriate containers, and snapshot the uploaded content.
Submit-SPOMigrationJob Submits a new migration job referenced to a previously uploaded package in Azure Blob storage into to a site collection...
Remove-SPOMigrationJob Removes a previously created migration job from the specified site collection.
Get-SPOMigrationJobProgress Reports on SPO migration jobs that are in progress.
Get-SPOMigrationJobStatus Monitors the status of a submitted SharePoint Online Migration job.

Hope this article helps you in learning SharePoint online management shell.