Download & then install SharePoint Online Management Shell from MS Windows Download Center to Windows Computer via PowerShell, and then download AdminRights.ps1 script in the same system in which SharePoint Online Management Shell is pre-installed.

In addition to it, after completely downloading and installing SharePoint Online Management Shell, follow the steps described in the article. For OneDrive Migration or user account backup, you need to create new service accounts with the Admin Privileges, and then assign SharePoint Site Account Connection Admin Privileges to it or you can use your old account but it should have admin rights.

Step 1: Create New Service Account with Admin Privileges

  • First of all, login to O365 Management Panel by an account with the Admin Privileges and Click on Sign-in button.

O365 Management Panel sign-in

  • Then click Users & Select “Add a User”

Add a user in Office 365 Users

  • In details page, enter all details for new service account and then click Add

New service account details page

  • In Settings Page, choose Yes for assigning Admin Permissions and from the drop-down menu, choose Global Admin. Additionally, the users can even add an alternate mail address & location and select Next.

Assign Global Admin role to user

  • In send results in mail page, click on Create Button. The service account information can’t be sent to Admin
  • For activating the account, log in to Office 365 Management Panel via a new Service Account and update its password

Also Read: Save Gmail Emails to OneDrive without Losing Data

Step 2: Configure Impersonation for OneDrive

Note: Make use of this step for configuring permission for the current users.

There are only two options that can be used for giving service account created in Step 1. Then make New Service Account access to the users’ accounts:
It provides two provisions for solving the purpose:

Provision 1: Run the SharePoint Online Management Shell script for applying for the proper permissions automatically for each user accounts, it can be preferred and fastest. In case of the multiple users, this can be the easiest method.

Provision 2: Configure the users account from Microsoft SharePoint Admin Center manually and in case you have only few users, it is completely an easy method.

Let’s get it clear now by going through two options:

Provision 1 : Assign Permission with SharePoint Online Management Shell Script

1.  Configure Permission via SharePoint Online Management Shell Script

2. Download & open admin rights.ps1 script in a text editor i.e., Notepad

Admin rights ps1 script in Notepad

3. Browse and edit the following four variables:

Note: It is mandatory to fill all the four options to run SharePoint Online Management Shell script.

Edit four variables in ps1 script

The domain name which you have entered while Logging in to o365 is to be used in the “AdminURL” & in “MyURL” as well.

$o365login: Replace Office 365 service account or administrator account username.
$o365pw: Replace Office 365 service account or administrator account password.
$spAdminURL: Replace the same URL used in organization’s OneDrive URL, but suffixed with-admin
$spMyURL: Replace the same URL used in organizations’ OneDrive URL, but suffixed with –my

4. First of all, save and close the entire script

5. Locate SharePoint Online Management Shell installed in first step and right click and run it as Administrator

Run SharePoint Online Management Shell as administrator

6.  If you will not run SharePoint Online Management Shell script as Admin then you will encounter an error “Set-ExecutionPolicy : Access to the registry key
‘HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell’ is denied.”

Set-ExecutionPolicy registry key access denied error

Thus, it is always recommended to run SharePoint Online Management Shell with Admin rights.

7.  In the next step, change the working directory in the SharePoint Online Management Shell to a location where you have stored AdminRights.ps1 script:

Change working directory in SharePoint Shell

8.  Run the command listed below:

Set-ExecutionPolicy Unrestricted

Set-ExecutionPolicy Unrestricted command

9.  After this, An option will be displayed asking “Do you want to change the execution policy?”. Enter Y to continue.

Enter Y to change execution policy

10.  Run the command for AdminRight.ps1 script:

.\AdminRights.ps1

Run AdminRights.ps1 script command

OneDrive impersonation PowerShell step

OneDrive impersonation PowerShell step

11. Hit Enter for completely exiting the script

Exit SharePoint Online Management Shell

12. Finally, exit the SharePoint Online Management Shell

Provision 2 : Assign Permissions from Admin Center of MS SharePoint

1. First of all, log in to O365 Management Panel with Service Account Credentials

2. Then Go to Admin Center & Select SharePoint

SharePoint option in Admin Center

3. Then, Click on User Profiles

User Profiles option in SharePoint admin

 

4. Then Click on Manage User Profiles.

Manage User Profiles option

 

5. Within Find Profiles field Type the Name of Account & click on Find

Find user account in Find Profiles field

6. Now Click on User Account Name & Select on Manage Site Collection Owners

Manage Site Collection Owners option

7. Now Site Collection Owner Window is displayed, within site collection Administrator field, add Service Account with Administrative Privilege. Enter The Username & Click on “Check User” icon

 

Check User icon for site collection administrator

 

Or Using, Directory Icon to Select Account from Directory

Directory icon to select account

 

8. Finally, Search within the Directory & Click on OK

Search directory and click OK

Conclusion

The above listed manual method to manage OneDrive impersonation for business permissions will help you to perform it solely. Hence, keep connected to the entire write-up and follow the process thoroughly.

Also Read: Microsoft OneDrive Stopped Working? Easy Steps to Fix It