Changing ODFB site ownership after user left the company

%3CLINGO-SUB%20id%3D%22lingo-sub-197030%22%20slang%3D%22en-US%22%3EChanging%20ODFB%20site%20ownership%20after%20user%20left%20the%20company%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-197030%22%20slang%3D%22en-US%22%3E%3CP%3EUnfortunately%20my%20company%20doesn't%20delete%20users%20when%20they%20leave%2C%20(they%20just%20get%20put%20in%20a%20special%20OU)%2C%20so%20the%20ODFB%20thing%20of%20reverting%20a%20site%20to%20their%20boss%20never%20kicks%20in.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20now%20I'm%20trying%20to%20change%203%20departed%20employee's%20accounts%20to%20their%20boss%2C%20and%20no%20matter%20what%20I%20do%20I%20can't%20get%20it%20to%20work.%26nbsp%3B%20Here%20is%20what%20I%20am%20typing%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS%20C%3A%5CData%5CScripts%26gt%3B%20Set-SPOUser%20-Site%20%3CA%20href%3D%22https%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2F%3C%2FA%3E%3CBR%20%2F%3Efaith_smith_123_com%20-LoginName%20david.johnson%40123.com%20-IsSiteCollectionAdmin%20%24true%3C%2FP%3E%3CP%3ESet-SPOUser%20%3A%20File%20Not%20Found.%3CBR%20%2F%3EAt%20line%3A1%20char%3A1%3CBR%20%2F%3E%2B%20Set-SPOUser%20-Site%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2Ffaith_smith_123_com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2Ffaith_smith_123_com%3C%2FA%3E%20...%3CBR%20%2F%3E%26nbsp%3B~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5BSet-SPOUser%5D%2C%20ServerException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.SharePoint.Client.ServerException%2CMicr%3CBR%20%2F%3Eosoft.Online.SharePoint.PowerShell.SetSPOUser%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20gone%20through%20a%20bunch%20of%20sites%20on%20the%20internet%2C%20and%20they%20all%20have%20more%20or%20less%20the%20same%20command.%26nbsp%3B%20I've%20trying%20a%20bunch%20of%20things%20like%20adding%20caps%2C%20no%20caps%2C%20removing%20the%20word%20tenant-%2C%20and%20so%20on%2C%20but%20nothing%20works.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20gone%20to%20my%20ODFB%20site%2C%20and%20then%20changed%20my%20name%20to%20her%20name%2C%20and%20get%20a%20message%20back%20saying%20you%20don't%20have%20access%20to%20this%20resource%2C%20so%20I%20assume%20that%20the%20site%20is%20there.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%202%20other%20users%20that%20I%20am%20trying%20to%20update%20and%20this%20isn't%20working%20for%20any%20of%20the%20three.%26nbsp%3B%20I%20get%20the%20same%20response%20on%20all%20of%20them.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20suggestions%20are%20much%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETed%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-197030%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOneDrive%20for%20Business%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-197450%22%20slang%3D%22en-US%22%3ERe%3A%20Changing%20ODFB%20site%20ownership%20after%20user%20left%20the%20company%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-197450%22%20slang%3D%22en-US%22%3E%3CP%3EOkay%2C%20this%20is%20weird%20.%26nbsp%3B%20I%20went%20through%20the%20admin%20portal%20and%20manually%20took%20over%20all%203%20account's%20Onedrive.%26nbsp%3B%20I%20then%20clicked%20on%20the%20link%20to%20have%20it%20open%20the%20user's%20onedrive%20location.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20location%20that%20popped%20up%20it%20said%20that%20there%20was%20no%20data%20other%20than%20an%20empty%20attachments%20folder.%26nbsp%3B%20That%20was%20it.%26nbsp%3B%20While%20we%20are%20kind%20of%20new%20to%20onedrive%2C%20and%20I%20can%20see%20the%20possibility%20that%20many%20users%20haven't%20put%20data%20in%20them%2C%20what%20we%20have%20done%20is%20redirect%20all%20C%3A%5Cusers%5Cted%20folder's%20to%20the%20onedrive%20folder.%26nbsp%3B%20That%20way%20all%20of%20that%20info%20is%20sync'd%20up%20to%20the%20cloud.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20even%20if%20the%20user%20hasn't%20put%20any%20data%20in%20there%20then%20there%20still%20should%20be%20a%20Desktop%2C%20Downloads%2C%20My%20Documents%2C%20My%20Pictures%2C%20etc.%26nbsp%3B%20I%20can't%20figure%20out%20why%20nothing%20shows%20but%20an%20attachments%20folder%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-197055%22%20slang%3D%22en-US%22%3ERe%3A%20Changing%20ODFB%20site%20ownership%20after%20user%20left%20the%20company%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-197055%22%20slang%3D%22en-US%22%3E%3CP%3EHere%20is%20my%20notes%2C%20make%20sure%20you%20have%20the%20latest%20powershell%20module%20installed%2C%20and%20make%20sure%20you%20connect%20to%20the%20-admin%20tenant%20as%20shown%20below.%20and%20make%20sure%20you%20run%20the%20SharePoint%20Online%20Powershell%20that%20gets%20installed%20as%20Admin.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EHow%20to%20connect%20PowerShell%20to%20Office%20365%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EYou%20must%20download%20and%20install%20SharePoint%20Online%20Management%20Shell%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D35588%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D35588%3C%2FA%3E%3CBR%20%2F%3ERun%20Sharepoint%20Online%20Management%20Shell%3CBR%20%2F%3ERun%20as%20admin%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EHow%20to%20grant%20admin%20access%20to%20OneDrive%20account%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ETo%20add%20access%20to%20Site%20collection%3C%2FSTRONG%3E%3CBR%20%2F%3EConnect-SPOService%20-Url%20%3CA%20href%3D%22https%3A%2F%2Ftenant-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant-admin.sharepoint.com%3C%2FA%3E%20-credential%20globaladminusername%40tenant.org%3CBR%20%2F%3ESet-SPOUser%20-Site%20%3CA%20href%3D%22https%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2Ftargerusername_tenant_org%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2Ftargerusername_tenant_org%3C%2FA%3E%20-LoginName%20usernamethatneedsadded%40tenant.org%20-IsSiteCollectionAdmin%20%24true%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-197042%22%20slang%3D%22en-US%22%3ERe%3A%20Changing%20ODFB%20site%20ownership%20after%20user%20left%20the%20company%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-197042%22%20slang%3D%22en-US%22%3E%3CP%3ESorry%2C%20I%20should%20have%20pointed%20out%20that%20my%20goal%20was%20to%20make%20this%20into%20a%20script%20that%20I%20could%20run%20against%20a%20spreadsheet%20of%20users%20who%20had%20left%20the%20company.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20thousands%20of%20users%20I%20have%20a%20feeling%20that%20this%20is%20going%20to%20be%20happening%20a%20lot.%26nbsp%3B%20One%20manager%20mentioned%20just%20making%20it%20part%20of%20the%20offboarding%20process%20that%20all%20employess%20account's%20undergo.%26nbsp%3B%20If%20that%20happens%20I'll%20have%20to%20do%20this%20for%20every%20user%20who%20leaves%20the%20company%2C%20and%20I%20SERIOUSLY%20do%20not%20want%20to%20have%20to%20do%20that%20manually.%26nbsp%3B%20My%20hope%20is%20that%20I%20can%20get%20a%20weekly%20spreadsheet%20of%20everyone%20who%20has%20left%20the%20company%20and%20then%20run%20this%20script%20against%20that.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ETed%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-197035%22%20slang%3D%22en-US%22%3ERe%3A%20Changing%20ODFB%20site%20ownership%20after%20user%20left%20the%20company%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-197035%22%20slang%3D%22en-US%22%3EHave%20you%20tried%20to%20add%20the%20new%20admins%20through%20the%20Office%20365%20Portal%20(user%20details%20pane)%20or%20the%20user%20profiles%20options%20in%20the%20SPO%20Admin%20Center%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1713646%22%20slang%3D%22en-US%22%3ERe%3A%20Changing%20ODFB%20site%20ownership%20after%20user%20left%20the%20company%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1713646%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F66914%22%20target%3D%22_blank%22%3E%40Ted%20McLaughlin%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Edo%20a%20get-spodeletedsite%20-site%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2F%3C%2FA%3E%3CBR%20%2F%3E%3CSPAN%3Efaith_smith_123_com%20is%20this%20is%20true%2C%20you%20can%20either%20resotre%20it.%20or%20you%20can%20add%20'1'%20in%20the%20end%26nbsp%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESet-SPOUser%20-Site%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant-my.sharepoint.com%2Fpersonal%2F%3C%2FA%3E%3CBR%20%2F%3Efaith_smith_123_com%3CSTRONG%3E1%3C%2FSTRONG%3E%20-LoginName%20david.johnson%40123.com%20-IsSiteCollectionAdmin%20%24true%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

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

 

 

5 Replies
Highlighted
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?
Highlighted

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

Highlighted

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 admin

 

 

How 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

Highlighted

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

Highlighted

@Ted McLaughlin 

 

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 end 

 

example

Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/
faith_smith_123_com1 -LoginName david.johnson@123.com -IsSiteCollectionAdmin $true