Add user to SharePoint group using PowerShell

In this PowerShell SharePoint tutorial, we will discuss how to add user to SharePoint group using PowerShell. Here we will use the SharePoint Online management shell.

Add user to SharePoint group using PowerShell

The SharePoint Online Management Shell is a tool that contains a Windows PowerShell Module to manage your SharePoint Online subscription in Office 365.

You can download and install SharePoint Online management shell before using the cmdlets to work with Office 365 SharePoint Online.

Steps to add a user into the SharePoint group using PowerShell.

Step 1: Open the SharePoint online management shell and copy the below command into your screen.

Note: Before going to start, make sure you have admin permission to the Office 365 tenant and the SharePoint Online site.

Connect-SPOService -Url https://pikasha12-admin.sharepoint.com/ -credential rswain44@pikasha12.onmicrosoft.com

Next it will ask you to enter the username and Password to access the site.

add user to sharepoint group using powershell
add user to sharepoint group using powershell

Step 2: Here is my SharePoint Online group where I want to add a new user.

how to add user to sharepoint group using powershell

Step 3: If your connection gets successful, copy the below command and paste it your screen.

Make sure you provide the correct SharePoint group name and user email id which you want to add into the SharePoint group.

Add-SPOUser -Site "https://pikasha12.sharepoint.com/sites/DLH" -Group "DLH Members" -LoginName Bandana@pikasha12.onmicrosoft.com
add user to group sharepoint 2013 powershell
powershell script to add users to sharepoint online group

Step 4: Now you can see, My new user has been added successfully into the group.

powershell script to add users to sharepoint online group

You may like following SharePoint tutorials:

In this way, we can add user to SharePoint group using PowerShell. This PowerShell script will work in SharePoint Online to add user to a group.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>