Orphaned SharePoint Online Site Collections after an O365 Group

itsbrooken

O365 Groups or Unified Groups is a cool O365 feature, except when it don’t work as expected.

You just deleted the Group, but the hidden SharePoint Online Site Collection connected to the group didn’t got deleted automatically with the group.

Guess what it’s now an orphaned site collection in locked state.

To Remove these sites, follow the script below:

 

##Connect to SPO

Connect-SPOService -Url https://tenant-admin.sharepoint.com

#Get all SPO Sites | find your orphaned O365 Group Site Collection
Get-SPOSite

#The SPO site Collection is actually locked, unlock it
Set-SPOSite -Identity https://tenant.sharepoint.com/sites/site -LockState Unlock

#If you were not Site Collection Admin before the O365 Group was deleted
Set-SPOSite -Identity https://tenant.sharepoint.com/sites/site -owner tenant-admin@yourdomain.com

#Then remove the orphaned site
Remove-SPOSite -Identity https://tenant.sharepoint.com/sites/sites -NoWait

 

FIX THIS MICROSOFT!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s