Change the owner Group membership of all SharePoint Online sites
I was required to limit the permission of all owners added to the default owner Group and assign them to the default member Group. I created this script using PnP PowerShell taking all the members of the default owner group and assigning them to the default member Group. After that I am removing the identity from the owner Group.
This script uses a
userNameOrPattern variable to allow you to limit the operation on selected identities.