The following are three essential PowerShell scripts for managing SharePoint Online:
Connect to the SharePoint Online admin center:
$adminUser = "admin@yourdomain.com"
$orgName = "yourorgname"
$Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $adminUser
Gets all site collections in SharePoint Online:
Get-SPOSite -Limit All
Sets the site collection administrator on a given site:
Set-SPOUser -Site https://yourdomain.sharepoint.com/sites/yoursite -LoginName user@yourdomain.com -IsSiteCollectionAdmin $true