Grant Access to a User's OneDrive using PowerShell


This PowerShell script is used to grant admin permissions to a user's OneDrive account, even if the user has been deleted from Active Directory.

First, you need to change the variables in the script below to the values that you need

Second, you need to sign into the SPO Service as a global administrator (or at least a SharePoint Administrator)

Install-Module -Name Microsoft.Online.SharePoint.PowerShell
 
# --- Change these variables ---
$SPAdminURL = "https://contoso-admin.sharepoint.com"
$OneDriveURL = "https://contoso-my.sharepoint.com/personal/user_contoso_com"
$AcctName = "grantAccessUser@contoso.com"
 
Connect-SPOService -Url $SPAdminURL
Set-SPOUser -Site $OneDriveURL -IsSiteCollectionAdmin $true -LoginName $AcctName 


Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.