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 [email protected]
Next it will ask you to enter the username and Password to access the site.
Step 2: Here is my SharePoint Online group where I want to add a new user.
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 [email protected]
Step 4: Now you can see, My new user has been added successfully into the group.
You may like following SharePoint tutorials:
- Get all users and groups in SharePoint 2013/2016 using PowerShell
- Export SharePoint groups to excel
- How to perform IIS backup and restore using PowerShell
- How to delete SharePoint site?
- Add user to SharePoint site
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.
Rajkiran is currently working as a SharePoint Consultant in India . Rajkiran having 7+ years of experience in Microsoft Technologies such as SharePoint 2019/2016/2013/2010, MOSS 2007,WSS 3.0, Migration, Asp.Net, C#.Net, Sql Server, Ajax, jQuery etc.He is C#Corner MVP (2 Times).