Powershell script to replace usergroup in SPO


I’m new here so sorry if I posted this wrong or maybe for the 100th time.

The usergroup “Visitors” in SPO contain a modified AAD group named “AllusersexceptABmembers”, is there a way to use a script or command within PowerShell to replace this group with the group “AllenabledAzureUsers”. If not I have to manually replace this within around 700 SPO sites.


Have you done any research? There are many factors such as SharePoint versions. A quick search ‘powershell sharepoint group members update’ you can get plenty of links to review such as:


Replace would basically be a Remove of the old group and Add of the new group.