Introduction to the SharePoint Online Management Shell

As a SharePoint Online admin, you can use the SharePoint Online Management Shell to run administrative commands from the command line. This introduction can help you manage users, sites, and organizations more efficiently.

In this article

What is the SharePoint Online Management Shell?

How do I get permissions and set up the environment?

SharePoint Online Management Shell cmdlet reference

What is the SharePoint Online Management Shell?

SharePoint Online Management Shell is a Windows PowerShell module. You can use it to manage SharePoint Online users, sites, site collections, and organizations from the command line, instead of using the SharePoint Administration Center user interface. Windows PowerShell enables you to perform these command-line operations by using a custom command called a cmdlet. A cmdlet, pronounced "command-let," is constructed as a verb-noun pair, such as Get-Command. The two parts of a cmdlet are separated by a hyphen (-) without spaces. The verb part refers to the action that the cmdlet takes. The noun part refers to the object on which the cmdlet takes action. Cmdlets are especially efficient for batch operations — for example, adding hundreds of new SharePoint Online users.

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.

How do I use the Windows PowerShell Command Builder?

The Windows PowerShell Command Builder Tool helps you quickly understand and use Windows PowerShell cmdlets for SharePoint Online. Suppose that you want to create a site. By using the Command Builder tool to create a cmdlet, you can create a site from the command line, instead of stepping through several pages in the user Interface. To use the tool, you just choose a verb, such as Add. The tool then filters the cmdlets that begin with that verb and shows you nouns that you can use with the specified verb, such as Site.

You can download the Command Builder tool and install it on your desktop. For more information, see Windows PowerShell Command Builder Getting Started Guide.

What is the difference between SharePoint Online cmdlets and Office 365 cmdlets?

The set of SharePoint Online Management Shell cmdlets differs from the set of Office 365 for business cmdlets. SharePoint Online Management Shell cmdlets manage SharePoint Online users and sites, whereas Office 365 for business cmdlets manage Office 365 level tasks such as domain, license, organization information, and services. They both manage users and groups. However, Office 365 users and groups apply not only to SharePoint Online services, but also to Exchange Online and Lync Online Services.

Should I use the SharePoint Online admin center or cmdlets?

If you have not used Office 365 and SharePoint Online before to administer SharePoint Online, the SharePoint Online admin center is a good place to start. For more information about the SharePoint Online admin center, see Video: Explore the SharePoint admin center or Find content about the SharePoint Online admin center.

After you become familiar with SharePoint Online features and technologies, just use Windows PowerShell cmdlets. Especially when you want to manage many SharePoint Online users, sites, or site collections, SharePoint Online Management Shell cmdlets are the choice.

How do I get permissions and set up the environment?

Get permissions

To run the SharePoint Online Management Shell cmdlets, you have to be a SharePoint Online global administrator.

Note:  To use cmdlets, a SharePoint Online site administrator must be a global administrator in Office 365.

Set up the environment

Before you can run cmdlets, you have to set up the SharePoint Online Management Shell environment and connect to the service. For more information, see Set up the SharePoint Online Management Shell environment.

After you set up the environment, you have to run Connect-SPOService before you can manage the users and site collections. If you have not run Connect-SPOService yet, you will receive an error message that no connection is available. Suppose that you want to connect to the SharePoint Online admin center for and your user name is To connect, you just run the following command:

Connect-SPOService -Url -credential

The following section contains links to cmdlet reference pages s by functionality for SharePoint Online and OneDrive.




Adds an existing Office 365 user or an Office 365 security group to a SharePoint group.


Returns the SharePoint Online user or security group accounts that match a given search criteria.


Removes a user or a security group from a site collection or a group.


Configures properties on an existing user.


Returns external users that are located in the tenant's folder based on specified criteria.


Permanently removes a collection of external users from the tenant’s folder.


Provides IT administrators the ability to sign out and invalidate a particular users' sessions across all their devices




Gets all the groups on the specified site collection.


Creates a new group in a SharePoint Online site collection.


Removes a SharePoint Online group from a site collection.


Updates the SharePoint Online owner and permission levels on a group inside a site collection.




Starts the upgrade process on a site collection.


Requests creation of a copy of an existing site collection for the purposes of validating the effects of upgrade without affecting the original site.




Returns all deleted site collections from the Recycle Bin


Removes a SharePoint Online deleted site collection from the Recycle Bin.


Restores a SharePoint Online deleted site collection from the Recycle Bin.


Returns one or more site collections.


Creates a new SharePoint Online site collection for the current company.


Sends a SharePoint Online site collection to the SharePoint Online Recycle Bin.


Checks and repairs the site collection and its contents.


Sets or updates one or more properties' values for a site collection.


Tests a SharePoint Online site collection.


Requests that one or more users be added to the queue for a Personal Site to be created




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.


Disconnects from a SharePoint Online service.




Returns application errors.


Returns all installed applications.


Returns SharePoint Online organization properties.


Sets properties on the SharePoint Online organization.


Retrieves SharePoint Online company logs.


Returns the time when the SharePoint Online organization logs are collected.


Displays all site templates that match the given identity.

Top of Page


Returns the current configuration status


Disables the feature for tenancy, but does not remove any present domain GUID entries from the safe sender recipient list.


Enables the feature for the tenancy and permits you to set the domain GUIDs in safe recipients list.


Re-maps a previously created file share based package or exported SharePoint package to accurately describe objects in a target web.


Creates a new migration package based on source files in a local or network shared folder.


Creates Azure containers, upload migration package files into the appropriate containers, and snapshot the uploaded content.


Submits a new migration job referenced to a previously uploaded package in Azure Blob storage into to a site collection. .


Removes a previously created migration job from the specified site collection.


Reports on SPO migration jobs that are in progress.


Monitors the status of a submitted SharePoint Online Migration job.

Was this information helpful?

How can we improve it?

How can we improve it?

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!