SharePoint/PnP-PowerShell has provide a great efforts to minimize code and increase productivity in SharePoint Online Development.
Recently we have to remove bulk amount of user from SharePoint Group. We decided to go with pnp power shell script to do it. As per the document Link – Remove User From Group below is the code.
Remove-PnPUserFromGroup -LoginName <String> -Identity <GroupPipeBind> [-Web <WebPipeBind>] i.e.
PS:> Remove-PnPUserFromGroup -LoginName firstname.lastname@example.org -GroupName 'Marketing Site Members' But above code didn't work. Actually we have to provide the -LoginName string like "i:email@example.com" and its work.Below is the working script. Remove-PnPUserFromGroup -LoginName "i:firstname.lastname@example.org" -GroupName 'Document'