Forum Discussion
Roger Roger
May 14, 2018Iron Contributor
copy files
Hi experts
one of my user has left the company and i can see his account disabled in active directory.
Now his boss asks me to copy all the users file from one drive and hand over to him. how do i achieve this.
- Bas WijdenesCopper Contributor
You can use PowerShell to achive this (for deleted SPO sites).
Set-sposite -Identity https://DOMAIN-my.sharepoint.com/personal/bas_wijdenes_domain_com -Owner "Roger.roger@baswijdenes.com
The owner will now be able to open the onedrive with the link already provided.
If you need more help, let me know.
- Roger RogerIron Contributor
Hi i am able to connect to shell using my credentials myuser@mydomain.com
PS C:\Windows\system32> Connect-SPOService -Url https://mydomain-admin.sharepoint.com
lets say deleted user is rogerfederer his domain account is roger.federer in AD and email id was roger.federer@mydomain.com
next should i proceed with which syntax
Set-SPOUser -Site https://mydomain-my.sharepoint.com/personal/roger_federer_mydomain.com -loginName roger.federer@mydomain.com -IsSiteCollectionAdmin $true
or
Set-SPOUser -Site https://mydomain-my.sharepoint.com/personal/roger.federer_mydomain.com -loginName roger.federer@mydomain.com -IsSiteCollectionAdmin $true
once its done can i access his file by the rul
https://mydomain-my.sharepoint.com/personal/roger_federer_mydomain_com/_layouts/15/onedrive.aspx
- Deletedprobably roger.federer_domain_com but just try both you won't hurt anything trying and you'll know when you get it cause you wont' get an error.
Also the -loginname is YOUR login or who you want to give access (make the site collection admin) not that user.
- Roger RogerIron Contributor
i am getting the below error, i have installed sharepoing management shell, i am getting below error
PS C:\Windows\system32> Connect-SPOService -Url https://teanant-admin.sharepoint
.com -credential myuser@mydomain.com
Connect-SPOService : Could not connect to SharePoint Online.
At line:1 char:1
+ Connect-SPOService -Url https://teanant-admin.sharepoint.com -credential
myuser ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : NotSpecified: (:) [Connect-SPOService], InvalidO
perationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Onlin
e.SharePoint.PowerShell.ConnectSPOServiceeven i tried both but i could not connect
Connect-SPOService -Url https://mydomain-my.sharepoint.com -credential myuser@mydomain.com
Connect-SPOService -Url https://mydomain-admin..sharepoint.com -credential myuser@mydomain.com
- Deleted
Best way is to give access to the OneDrive location and let them download the stuff they need.
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://teanant-admin.sharepoint.com -credential username@domain.org
Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/targerusername_domain_org -LoginName username@domain.org -IsSiteCollectionAdmin $true- Roger RogerIron Contributor
Connect-SPOService -Url https://teanant-admin.sharepoint.com -credential username@domain.org
is username@domain.org is deleted users account?
Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/targerusername_domain_org -LoginName
username@domain.org -IsSiteCollectionAdmin $trueis username@domain.org is deleted users account?
- DeletedThe first part is connecting to your tenant and that is your admin login. The 2nd part is the user you want to add to the site as a site collection admin. So either you or the person wanting access to the files account.
- Roger RogerIron Contributor
Hi experts
I can see this user under deleted users.
Home-Users-Deleted users.
Is there any way to recover data of this user, i read earlier that contents will be preserved for one month
- DeletedYes follow the posts we put to assign site collection admin to yourself or the person needing permission to the OneDrive site. You have at least 30 days to do so unless you have preservation turned way up then you have longer.
- You can also add yourself as ODFB owner using the user interface: https://www.petri.com/4-ways-add-secondary-administrator-onedrive-business
- DeletedYeah but he disabled the user aka it moves to deleted, don't think you can use UI at that point!