Overview:
As we know, in general, site collection owners can be changed/updated from both browser UI and PowerShell script but for Group sites there is no option to change the site owner from browser/UI. So, unlike other site collections in O365 SharePoint tenant, the Group site owners are manageable only through PowerShell script.
Now let’s go through the steps to change the site owner using PowerShell script:
Step 1: Open “SharePoint Online Management Shell” OR “SharePoint 2013 Management Shell” if latest online components installed
Step 2: Run the below-given script line that tries to authenticate with O365 SharePoint tenant and then provide “https://YourTenantName-admin.sharepoint.com” URL to login:
Connect-SPOService
Step 3: Once you enter URL, it will ask for credentials. Please enter “Tenant admin” credentials.
Step 4: On successful authentication, please run the below-given script line to get Site information
Get-SPOSite https://YourTenantName.sharepoint.com/sites/TestSite |fl
Step 5: To change the Site Owner, please run the below-given script line.
Set-SPOSite https://YourTenantName.sharepoint.com/sites/TestSite -Owner testaccount@YourTenantName.com
We can use the same script to change site owners for Classic Team and Communication sites as well.