Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Need help with Powershell Script to export list of OneDrive for business site collection owners.

Need help with Powershell Script to export list of OneDrive for business site collection owners.

Scheduled Pinned Locked Moved SharePoint
sharepointhelpcomwindows-adminlinux
1 Posts 1 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SiddiquiMohammed
    wrote on last edited by
    #1

    Hello, I am new to this site. I am the SharePoint Online Administrator. In our organisation we need to perform the audit. we would like to know the user names that are having full control or are in owners group in all the OneDrive for business site collections in office 365 SharePoint Online. I was trying to create the script but at some point it is throwing an error. the script is mentioned below. Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue Import-Module ‘C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell’ -DisableNameChecking $Fulldomain="makaveli.onmicrosoft.com"    #Step2: Connect to SharePoint Online and MsolService  $credential = get-credential   Connect-SPOService -Url “https://makaveli-admin.sharepoint.com/” -Credential $credential   Connect-MsolService -Credential $credential    #Step3: Set OneDrive Storage Quota for all Office 365 Users   $users=Get-MsolUser  $users | Foreach-Object{   $user=$_  $username=($user.userprincipalname –Split “@”)[0]  $Dname=($Fulldomain -Split "\.")  If($Dname[2] -ne $null)  {  $Firstname=$Dname[0]  $Secondname=$Dname[1]  $thirdname=$Dname[2]  $sitename= "https://"+$Firstname+"-my.sharepoint.com/personal/"+$username+"_"+$Firstname+"_"+$Secondname+"_"+$thirdname  }  Else  {  $Firstname=$Dname[0]  $Secondname=$Dname[1]  $sitename= "https://"+$Firstname+"-my.sharepoint.com/personal/"+$username+"_"+$Firstname+"_"+$Secondname   }  $Groups = Get-SPOSiteGroup -Site $sitename Foreach($Group in $Groups){ Foreach($Role in $Group.Roles){ If ($Role.Contains(“Full Control”)) { Write-Host $Group.Title Write-Host $Group.Users $users = $Group.Users -join ‘ ‘ $title = $Group.Title $props = @{Title = $title Users = $users Website = $sitename } $temp = New-Object psobject -Property $props $temp | export-csv –append –path C:\SiteOwnerandSites.csv } }}} ================================================== by running the above script I am getting the following error message: Get-SPOSiteGroup : Cannot get site https://makaveli-my.sharepoint.com/personal/Mohammed_makaveli_onmicrosoft_com. At line:32 char:11 + $Groups = Get-SPOSiteGroup -Site $sitename + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-SPOSiteGroup], ServerException + FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.GetSPOSiteGroup I am able

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups