Dropbox comes in handy as a way of distributing files across systems. You can easily get files to a whole fleet of computers and then use PowerShell to automate tasks.
If you ever wanted to run Dropbox as a Windows Service so it starts with Windows before a user logs in, follow the instructions below.
But first you need this tool srvany
- Delete the Dropbox service:
sc delete "Dropbox Service"
- Run the following command:
sc create Dropbox binPath= "C:\...\srvany.exe" DisplayName= "Dropbox Service"
- Choose properties on Dropbox service > Click on tab “Log On” > Click “This account“, and select the appropriate account in order to run dropbox > Set appropriate password > Set startup type to “Automatic“.
- Run in PowerShell:
New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dropbox\Parameters New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dropbox\Parameters -Name Application -PropertyType String -Value "C:\Program Files (x86)\Dropbox\Client\Dropbox.exe"
- Go back to Services, and start the Dropbox service
Then, you can incorporate Dropbox into PowerShell by finding the correct Dropbox location and Dropbox path in Windows automatically using PowerShell. The PowerShell below will assign the correct Dropbox path to a variable $dropboxpath which you can use throughout your PowerShell script.