Powershell Script to Make Your Global Admin Account the Owner of a Sharepoint Online Site

Purpose        1

Script        1

Example        1

Revisions        1

Purpose

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.

Script

Import-Module MSOnline

$SPOnlineAdmin="youradmin@yourdomain.onmicrosoft.com

# Assuming multifactor (if you don’t have this turned on do it now)

$Adminurl = "https://yourdomain-admin.sharepoint.com"

Connect-SPOService -url $Adminurl

$siteurl=”https://yourdomain.sharepoint.com/sites/yoursite

Set-SPOUser -site $siteurl -LoginName $SPOnlineAdmin -IsSiteCollectionAdmin $True

Example

For AMC

Import-Module MSOnline

$SPOnlineAdmin="amcsupport@AppalachianMountainClub.onmicrosoft.com”

# Assuming multifactor (if you don’t have this turned on do it now)

$Adminurl = "https://appalachianmountainclub-admin.sharepoint.com"

Connect-SPOService -url $Adminurl

$siteurl=”https://appalachianmountainclub.sharepoint.com/teams/depts”

Set-SPOUser -site $siteurl -LoginName $SPOnlineAdmin -IsSiteCollectionAdmin $True

Revisions

PS051818

Initial Version

PS080118

Added Example

THIS INFORMATION IS PROVIDED “AS IS” WITH NO WARRANTY OF ANY KIND AS TO THE ACCURACY OF ITS CONTENT.