Instantly share code, notes, and snippets.
Last active
December 29, 2025 05:36
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
-
Save contactbrenton/e92a7196ae562108298558392df581b9 to your computer and use it in GitHub Desktop.
How to auto-provision Dropbox as a Place for your team - Source: https://help.dropbox.com/view-edit/admin-guide-co-authoring#Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Provision (register) Dropbox for Teams as an Office "Place" / storage provider in Microsoft 365 desktop apps for the currently logged-on user. | |
| .MICROSOFT INTUNE DEPLOYMENT SETTINGS | |
| ------------------------------------ | |
| When deploying this script via Microsoft Intune (Devices > Scripts), configure the following options: | |
| - Platform: Windows | |
| - Target OS versions: Windows 10 and Windows 11 | |
| - Run this script using the logged-on credentials: Yes | |
| - Run script in 64-bit PowerShell: Yes | |
| - Enforce script signature check: No | |
| - Execution context: User | |
| - Recommended: User assignment | |
| This script should be deployed to users, as it provisions a per-user Office storage provider and relies on HKCU and user context. Deploying to devices may result in inconsistent behaviour across users. | |
| These settings are required because the script reads from and writes to HKCU and provisions an Office storage provider on a per-user basis. | |
| .WHAT THIS SCRIPT DOES | |
| ---------------------- | |
| This script checks whether the Dropbox for Teams storage provider is already present for the current user in the Office Services Manager cache (HKCU). | |
| - It detects the installed Office Click-to-Run version and derives the Office "major" registry version (e.g. 16.0). | |
| - It then looks under: | |
| HKCU:\Software\Microsoft\Office\<OfficeVersion>\Common\ServicesManagerCache\Local | |
| for a ServiceId matching Dropbox for Teams (TP_DROPBOX_PLUS). | |
| - If Dropbox for Teams is not found, the script invokes the Office storage host protocol handler: | |
| ms-office-storage-host:asp|d|TP_DROPBOX_PLUS|o|1|a|script | |
| which triggers Office to add/provision the Dropbox for Teams storage provider for the user. | |
| .NOTES / LIMITATIONS | |
| -------------------- | |
| - This provisions/initiates the Dropbox for Teams "place" for the user, but authentication is still per-user. | |
| - The script is idempotent and safe to run multiple times; provisioning only occurs if the service is not already registered. | |
| - Must be executed in user context; running in system context will fail. | |
| .POST-DEPLOYMENT USER ACTION REQUIRED | |
| ------------------------------------- | |
| Once the above steps have been implemented, each user on your team will need to manually authenticate Dropbox as a location in the Microsoft 365 desktop apps. | |
| To do so: | |
| - Open any Microsoft 365 desktop application (e.g. Word or Excel) | |
| - Navigate to File > Open > Add a place | |
| - Select Dropbox and sign in with their Dropbox credentials | |
| .POST-DEPLOYMENT EXAMPLE USER INSTRUCTIONS (SEND TO END USERS) | |
| ----------------------------------------------------- | |
| Dropbox has now been enabled as a location in Microsoft 365 desktop apps. | |
| Each user needs to complete a one-time sign-in to finish the setup. | |
| Please follow the steps below on your computer: | |
| 1. Open any Microsoft 365 desktop application (Word, Excel, or PowerPoint) | |
| 2. Select File | |
| 3. Select Open | |
| 4. Select Add a place | |
| 5. Choose Dropbox | |
| 6. Sign in using your Dropbox email address and password | |
| Once signed in, Dropbox will appear as a location when opening or saving files in Microsoft 365 desktop apps. | |
| If you do not see Dropbox as an option, restart your device try again. | |
| #> | |
| $DropboxForTeamsServiceId = 'TP_DROPBOX_PLUS'; | |
| function Get-DropboxForTeamsExists { | |
| param ($OfficeVersion) | |
| $serviceExists = 0; | |
| $localServices = Get-ChildItem -Path "HKCU:\Software\Microsoft\Office\$OfficeVersion\Common\ServicesManagerCache\Local" | |
| foreach ($value in $localServices) { | |
| $service = Get-ItemProperty "HKCU:\$value" | |
| if ($service.ServiceId -eq $DropboxForTeamsServiceId) { | |
| $serviceExists = 1; | |
| break | |
| } | |
| } | |
| $serviceExists; | |
| } | |
| # Get current office version | |
| function Get-OfficeVersion { | |
| $officeVersionX32 = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration' -ErrorAction SilentlyContinue -WarningAction SilentlyContinue) | Select-Object -ExpandProperty VersionToReport | |
| $officeVersionX64 = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Office\ClickToRun\Configuration' -ErrorAction SilentlyContinue -WarningAction SilentlyContinue) | |
| if ($officeVersionX32 -ne $null -and $officeVersionX64 -ne $null) { | |
| $officeVersion = $officeVersionX64 #Use x64 as default. | |
| } elseif($officeVersionX32 -eq $null -or $officeVersionX64 -eq $null) { | |
| $officeVersion = $officeVersionX32 + $officeVersionX64 | |
| } | |
| $officeVersionMain = $officeVersion.Split(".")[0] + '.0' | |
| $officeVersionMain | |
| } | |
| Write-Host "Dropbox for Teams provisioning script initialized." | |
| Write-Host "Detecting Office version." | |
| $officeVersion = Get-OfficeVersion | |
| Write-Host "Office version detected: $officeVersion" | |
| $dropboxForTeamsExists = Get-DropboxForTeamsExists -OfficeVersion $officeVersion | |
| if($dropboxForTeamsExists -eq 0) { | |
| Write-Host "Dropbox for Teams not found, running provisioning script." | |
| <# | |
| Paremeters used within script | |
| - `asp` = Add storage provider command | |
| - `d` = Read service identifier field | |
| - `o` = This is lower-case letter ‘o’ not zero. Read operation identifier to indicate is silent or not | |
| - `1` = Invoke in silent mode (intended to be invoked on user login) | |
| - `a` = Lower-case letter ‘a’. Read the invoking application identifier | |
| - `script` = The application invoking the protocol handler for debugging and logging use. In this case it is script. | |
| #> | |
| start "ms-office-storage-host:asp|d|$DropboxForTeamsServiceId|o|1|a|script" | |
| Write-Host "Provision script finished." | |
| } else { | |
| Write-Host "Dropbox for Teams found exiting..." | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment