How To Use PowerShell With SharePoint Online

Overview

This blog covers how we can use PowerShell with SharePoint Online. When we are a beginner in SharePoint, we always have a question in our mind, that is, "how to use PowerShell"?

You need the following software to be installed on the machine to use SharePoint Online PowerShell.

  • SharePoint Online Management Online Shell
  • Windows PowerShell ISE (Not Necessary. Use only if you need better user interface and debugging functionality)

Step 1

Right click > SharePoint Online Management Shell > Run as Administrator.

 

Step 2

It will open Command Prompt.

 

Step 3

We will add the following code snippet to connect to the SharePoint Online Environment. 
  1. Connect-SPOService -Url https://lt16-admin.sharepoint.com -Credential [email protected]

Here -URL = URL of your SharePoint Admin Center site having admin rights. Ex: https://domain-admin.sharepoint.com 

Credential = username of SharePoint Tenant.

 

Step 4

The following screen will open.

Enter Password:

 

After successful connection, it will prompt the below screen.

 

Step 5

Now, add your PowerShell script which you want to perform.

Ex

If need all available groups in a site, we can use the following code snippet.

  1. Get-SPOSiteGroup -Site $y

Conclusion

This is how we can use PowerShell Scripts with SharePoint Online.

Ebook Download
View all
Learn
View all