Tuesday, October 25, 2022

Export Site Owners form SharePoint Online

 $AdminCenterURL = ""

 

#Connect to SharePoint Online

Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

 

#Get Site owners of all site collections

Get-SPOSite -limit ALL | Select URL, Owner| Export-Csv d:\sites.txt




get-sposite | %{ $user = get-spouser -site $_ -loginName "emailid1@rbeerla.onmicrosoft.com"; if($user.Groups.Count -gt 0){write-output $_.url ":" $user.Groups} }