Before we begin, we need to make sure what type of PnP module had been installed in your machine. To check please execute the following command in PowerShell
- Get-Module SharePointPnPPowerShell* -ListAvailable | Select-Object Name,version

In case you receive any error like “SharePointPnpPowershell module couldn’t find in this computer," then you need to download and install the latest version of PnP Module. To install the latest version please execute the below mentioned command to download and install directly from the PowerShell gallery
Open Powershell in Administrator mode and execute the below command,
- Set-Executionpolicy remotesigned
- #For SharePoint Online
- Install-Module SharePointPnPPowerShellOnline
- #For SharePoint 2016
- Install-Module SharePointPnPPowerShell2016
- #For SharePoint 2019
- Install-Module SharePointPnPPowerShell2019
- #To connect SharePoint Online
- Connect-PnPOnline -Url https://tenant.sharepoint.com -UseWebLogin
Here I am using –UseWebLogin to authenticate my credentials through browser interface to overcome the MFA Authentication.
Once it got connected, just execute the below command to create a SharePoint Group,
- New-PnPGroup -Title "Custom"
- Get-PnPGroupMembers -Identity "Custom"

If the above command returns a successful result then execute the below command to add users to the SharePoint group,
- Add-PnPUserToGroup -LoginName [email protected] -Identity "Custom"

- Remove-PnPUserFromGroup -LoginName [email protected] -Identity "Custom"
- Remove-PnPGroup -Identity "Custom"
- Set-PnPGroupPermissions -Identity "Custom" -AddRole Contribute
- Set-PnPGroupPermissions -Identity "Custom" -RemoveRole "Read" -AddRole "Full Control"
- Set-PnPGroupPermissions -Identity "Custom" -List "CustomList" -RemoveRole "Read" -AddRole "Contribute"


Join the conversation! Your thoughts help the community grow.