PowerShell, Quick Tips, Scripting
comments 10

Using DropBox to share PowerShell profile scripts across computers

I started using DropBox for several months ago and I love the way it syncs information across several computer I own. I put all the scripts under development in a DropBox folder and work on them from any PC I have access to. And, the changes are always there on all PCs. There is versioning too. This is simply awesome.

Apart from the usual stuff like sharing documents, scripts, and photos, I also use DropBox to share my PowerShell profile scripts across all these computers I work on. All this is done automatically. I just need to set it up once and all my computers receive the changes to my profile script almost instantly. This is how I have been doing it:

First, I have DropBox setup on all my computers.

Second, I created a folder within DropBox folder and called it PowerShellProfiles.

DropBox folder

DropBox folder

After this, I copied all my PowerShell profile scripts to the PowerShellProfiles folder on DropBox. BTW, I use two different profiles. One for PowerShell console/PowerGUI and another just for ISE. This is just a choice. You could have everything in Profile.PS1. But that is lot of extra lines of code to verify PowerShell host type, etc.

PowerShell profile Scripts

PowerShell profile Scripts

Here comes the trick of auto-magically using these profiles within PowerShell console, PowerShell ISE, and PowerGUI. I just had to create hard links to these files in the DropBox folder at my Windows PowerShell profile scripts path. To do this, I used fsutil.exe — native binary in Windows. Make a note that you need admin privileges to run fsutil.

Here is how I used it:

Update: If you need to hard link directories, they are called junctions windows, you need to use junction.exe from Sysinternals tools. For example, if you want to copy your modules folder as well to DropBox and create a link to it in the PowerShell Modules Path:

This is it. This will create hard links to my profile scripts. I did this on all my computers and this is just one time. From now on, every time I modify the profile scripts, all changes appear on all other computers automatically through DropBox.

Do let me know how you do it.

You can get a DropBox account with 2GB of free space http://db.tt/1DID1mR. 2GB, in my opinion, is more than enough for simple scripts. There are also other choices in the market. However, I recommend DropBox. The free account supports restoring 30 days old file versions.

Filed under: PowerShell, Quick Tips, Scripting


Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.