Powershell Script to Make Your Global Admin Account the Owner of a Sharepoint Online Site
Ownership of a Sharepoint Online Site is granted to the user who sets up the site. This can cause problems for you as a Global Administrator to manage the site. So take control!
You have to be Global Admin to run this script.
# Assuming multifactor (if you don’t have this turned on do it now)
$Adminurl = "https://yourdomain-admin.sharepoint.com"
Connect-SPOService -url $Adminurl
Set-SPOUser -site $siteurl -LoginName $SPOnlineAdmin -IsSiteCollectionAdmin $True
THIS INFORMATION IS PROVIDED “AS IS” WITH NO WARRANTY OF ANY KIND AS TO THE ACCURACY OF ITS CONTENT.