Forum Discussion
Changing ODFB site ownership after user left the company
Unfortunately my company doesn't delete users when they leave, (they just get put in a special OU), so the ODFB thing of reverting a site to their boss never kicks in.
So now I'm trying to change 3 departed employee's accounts to their boss, and no matter what I do I can't get it to work. Here is what I am typing:
PS C:\Data\Scripts> Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/
faith_smith_123_com -LoginName david.johnson@123.com -IsSiteCollectionAdmin $true
Set-SPOUser : File Not Found.
At line:1 char:1
+ Set-SPOUser -Site
https://tenant-my.sharepoint.com/personal/faith_smith_123_com ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-SPOUser], ServerException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Micr
osoft.Online.SharePoint.PowerShell.SetSPOUser
I've gone through a bunch of sites on the internet, and they all have more or less the same command. I've trying a bunch of things like adding caps, no caps, removing the word tenant-, and so on, but nothing works.
I've gone to my ODFB site, and then changed my name to her name, and get a message back saying you don't have access to this resource, so I assume that the site is there.
I have 2 other users that I am trying to update and this isn't working for any of the three. I get the same response on all of them.
Any suggestions are much appreciated.
Ted
- Have you tried to add the new admins through the Office 365 Portal (user details pane) or the user profiles options in the SPO Admin Center?
- Ted McLaughlinBrass Contributor
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- Deleted
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
- Ted McLaughlinBrass Contributor
Okay, this is weird . I went through the admin portal and manually took over all 3 account's Onedrive. I then clicked on the link to have it open the user's onedrive location.
In the location that popped up it said that there was no data other than an empty attachments folder. That was it. While we are kind of new to onedrive, and I can see the possibility that many users haven't put data in them, what we have done is redirect all C:\users\ted folder's to the onedrive folder. That way all of that info is sync'd up to the cloud.
So even if the user hasn't put any data in there then there still should be a Desktop, Downloads, My Documents, My Pictures, etc. I can't figure out why nothing shows but an attachments folder
- HysenTmavaCopper Contributor
do a get-spodeletedsite -site https://tenant-my.sharepoint.com/personal/
faith_smith_123_com if this is true, you can either restore it, or you can add '1' in the endexample
Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/
faith_smith_123_com1 -LoginName david.johnson@123.com -IsSiteCollectionAdmin $true