How to add an account to the Personal SharePoint Site Collection (OneDrive) Administrators for each OneDrive enabled user in a tenant via a script.
Each Personal SharePoint Site Collection (OneDrive) is secured for the OneDrive user only, which disables Enterprise Reporter’s ability to enumerate objects in each Personal Site Collection. To enable this function, the account used by Enterprise Reporter to enumerate Azure/O365 objects will need to be added to the Personal Site Collection for each OneDrive enabled user either manually or by script.
NOTE: Install the SharePoint Online Management Shell before running the attached script.
https://www.microsoft.com/en-us/download/details.aspx?id=35588
Attached is a script that will walk the tenant, determine which tenant users are OneDrive enabled, and then add the specified account to the Personal SharePoint Site Collection Admins group. This will allow the named account in Enterprise Reporter to have access to the site collections.
The script is designed to ask for a global administrator account and password, storing the password in a secured fashion. It will then ask for the account to be inserted into the Personal Site Collection Administrators group. Once that information has been provided, the script will determine the tenant user accounts which are OneDrive enabled, then add the specified account into the Personal Site Collection Administrators group.
Script Disclaimer:
The information in the script(s) provided is known to work successfully; however, they have not been officially tested by Quest Software Quality Control. If any of these instructions are changed and/or incorrectly used, intentionally or unintentionally, this solution becomes unsupported by Quest Software Support and Development.
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center