1addc9d5dd
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 4s
47 lines
1.9 KiB
Markdown
47 lines
1.9 KiB
Markdown
## Purpose
|
|
You may find that you need to access data from a user's personal OneDrive account, and since that data cannot be accessed directly via Office365's Admin Portal, you have to do some legwork in Powershell.
|
|
|
|
### Connect to Sharepoint
|
|
```powershell
|
|
Install-Module Microsoft.Online.SharePoint.PowerShell
|
|
Import-Module Microsoft.Online.SharePoint.PowerShell
|
|
Connect-SPOService -Url https://<companyname>-admin.sharepoint.com # Login with your Office365 Admin Credentials when Prompted
|
|
```
|
|
|
|
### Display List of Personal Sharepoint Sites (OneDrive)
|
|
```powershell
|
|
Get-SPOSite -IncludePersonalSite $true -Limit All
|
|
```
|
|
|
|
### Check OneDrive Usage of the Given User
|
|
```powershell
|
|
Get-SPOSite -Identity "https://<companyname>-my.sharepoint.com/personal/username_companyname_com" | Select Url, Owner, StorageUsageCurrent, StorageQuota, LastContentModifiedDate
|
|
```
|
|
|
|
### Assign Yourself Permissions to Their OneDrive
|
|
```powershell
|
|
Set-SPOUser `
|
|
-Site "https://eaglesafetyak-my.sharepoint.com/personal/username_companyname_com" `
|
|
-LoginName "i:0#.f|membership|admin@companyname.com" `
|
|
-IsSiteCollectionAdmin $true
|
|
```
|
|
|
|
### Navigate to Webpage
|
|
At this point, you now have permissions to access the OneDrive data, so open a web browser and navigate to the SPOSite URL seen previously, seen below. From here, you can download, upload, and manage the data however you need.
|
|
- `https://<companyname>-my.sharepoint.com/personal/username_companyname_com`
|
|
|
|
### Remove Permissions
|
|
At this point, when the work is done, revoke your permissions to lock-down the OneDrive data once again by running the following command:
|
|
```powershell
|
|
Set-SPOUser `
|
|
-Site "https://eaglesafetyak-my.sharepoint.com/personal/username_companyname_com" `
|
|
-LoginName "i:0#.f|membership|admin@companyname.com" `
|
|
-IsSiteCollectionAdmin $false
|
|
```
|
|
|
|
### Logout & Cleanup Auth Tokens & Remove Module
|
|
```powershell
|
|
Disconnect-SPOService
|
|
Remove-Module Microsoft.Online.SharePoint.PowerShell
|
|
# Close Powershell Window
|
|
``` |