Provision OneDrive and set global administrator for OneDrive accounts in Office365

Recently I was working in a project to migrate all the SharePoint on-premise stuffs to Office365 including file shares. All the users had their on file shares mapped to their home drives on the PC. And the requirement is to move all the home drive data to OneDrive for Business and let the Global administrators to manage them efficiently.

Though Office 365 admin page have functionality to set Global admin for SharePoint sites, for OneDrive sites there is no OOB way to set a Global admin for all the sites. And its very tedious to set this manually for 400+ users.

Below script will help the IT pro’s to

1) Store the Office admin credentials

2) Provision OneDrive Sites for list of users

3) Assign administrator for provisioned OneDrive sites


Download the script and change the Variables in “Input Variables” section to suit your environment

#Input Variables Begin
 #Credentials Store Location
 #Log File location
 $Logfile = "C:\GG\OneDriveProvisionReport.log"
 #O365 Global admin
 $O365AdminAccount = "";
 #O365 Onedrive admin
 $OneDriveAdminAccount = "";
 #O365 Admin site URL
 $webUrl = ""
 #List of OneDrive users (seperated by CSV)
 $OneDriveUsers = "","" 
# Input Variables End

Click here the download the script.

5 thoughts on “Provision OneDrive and set global administrator for OneDrive accounts in Office365

  1. Pingback: SharePoint 2013: Recopilatorio de enlaces interesantes (LX)! - Blog de Juan Carlos González en Geeks.MS

  2. Hello, nice post. However i’m wondering if you have the Powershell version of this script. I’m searching for a powershell script that Pre-provisions OneDrive for New users. ANy help will be appreciated.

    Many thanks

Leave a Reply

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

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s