Forum Discussion
Changing ODFB site ownership after user left the company
Sorry, I should have pointed out that my goal was to make this into a script that I could run against a spreadsheet of users who had left the company.
With thousands of users I have a feeling that this is going to be happening a lot. One manager mentioned just making it part of the offboarding process that all employess account's undergo. If that happens I'll have to do this for every user who leaves the company, and I SERIOUSLY do not want to have to do that manually. My hope is that I can get a weekly spreadsheet of everyone who has left the company and then run this script against that.
Ted
- DeletedMay 23, 2018
Here is my notes, make sure you have the latest powershell module installed, and make sure you connect to the -admin tenant as shown below. and make sure you run the SharePoint Online Powershell that gets installed as Admin.
How to connect PowerShell to Office 365
You must download and install SharePoint Online Management Shell
https://www.microsoft.com/en-us/download/details.aspx?id=35588
Run Sharepoint Online Management Shell
Run as adminHow to grant admin access to OneDrive account
To add access to Site collection
Connect-SPOService -Url https://tenant-admin.sharepoint.com -credential globaladminusername@tenant.org
Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/targerusername_tenant_org -LoginName usernamethatneedsadded@tenant.org -IsSiteCollectionAdmin $true