Synchronize your PowerShell Profile with OneDrive

by Bharat Suneja on September 24, 2014

I make frequent changes to my PowerShell profile and like to have the same PowerShell envirnoment on all computers that I use PS from. To accomplish this, I used to copy the PowerShell profile to a folder on OneDrive (previously known as SkyDrive) and copy it back to the WindowsPowerShell folder on other computers – first, manually, and then using a script.

But there’s an easier way to have a single copy of your PowerShell profile and store it on OneDrive. This method allows PowerShell to automatically use the synchronized version on OneDrive. If you make changes to the profile, you no longer have to worry about copying the updated local version to OneDrive (manually) or sync/copy the updated version from OneDrive to all computers.

If you’re thinking about how complicated this solution is going to be, you can discard that thought right now! If simple solutions make you happy, this should make you jump with joy.

The caveat with this approach, if it can be called that: Changes AND Deletions are synced to all computers where you set it up.

Folder or file Default path
Windows user profile C:\Users\<username>
PowerShell profile file C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Microsoft OneDrive folder C:\Users\<username>\OneDrive

Here’s how it works:

1. Install OneDrive If you don’t have OneDrive app installed on your computer (it’s included on Windows 8 and later), install it.
2. Create a WindowsPowerShell folder on OneDrive Navigate to your OneDrive folder (the cached copy on your local drive) and create a WindowsPowerShell folder here.

By default, the OneDrive app synchronizes your data to the OneDrive folder in your user profile (Default: C:\users\<username>\OneDrive). I change mine to a root level folder (for example: C:\Bharat\OneDrive) to make it easier to type.

3. Rename the WindowsPowerShell folder in your user profile If you have a WindowsPowerShell folder in the Documents folder in your profile (C:\users\<username>\Documents\WindowsPowershell), rename it to something like WindowsPowerShell-BAK.
4. Create a symbolic link Create a symbolic link called WindowsPowerShell in the Documents folder and point it to the WindowsPowerShell folder in your OneDrive folder.

mklink /D “WindowsPowerShell” c:\Bharat\OneDrive\ps\WindowsPowerShell

5. Rinse and repeat on your other computers.

Now start PowerShell. If you have a PowerShell profile in the OneDrive folder, it’ll load by default. Any changes made to the profile will sync to the other computers.


I’ve been participating in the Garage Series shows with host Jeremy Chapman. Most shows are recorded live at Microsoft events such as TechEd, TechReady (an internal Microsoft technical event), Microsoft Exchange Conference (MEC) and Microsoft SharePoint Conference, on the road (some recent ones have been in Prague and Hong Kong). You can find the shows on Office Blogs – the YouTube videos are embedded in blog posts. The show has a trivia question in the beginning. If you’re attending the show live, you can win prizes for answering the trivia question.

In this week’s Garage Series show, Jeremy and I talk about the top new features in Exchange 2013 SP1.

If you’re attending TechEd North America 2014 in Houston, TX, next week, catch a Garage Series show for some quick infobytes and answer the trivia question for a chance to win some cool prizes. The full schedule for Garage Series at TechEd 2014 is at the end of this post.


Connection Filtering and RBLs in Exchange 2013

April 17, 2013

Exchange 2003 and later have included Connection Filtering in its repertoire of built-in anitspam tools. In Exchange 2007 and Exchange 2010, this is implemented using the Connection Filtering agent, a transport agent. Connection Filtering agent offers the following functionality: IP Allow List and IP Block List: Static lists of IP addresses you can populate to […]

Read the full article →

Make Bing the default search engine in Firefox address bar

March 19, 2013

I like Bing for a number of reasons. If you don’t prefer Bing, this is not a sales pitch to make you change your search habits. I’ll leave that to the Bing team with BING IT ON, the Bing Challenge commercials et al. Bing offers a better user experience. I also believe Microsoft has better […]

Read the full article →

Windows PowerShell 3 Wins InfoWorld’s 2013 Technology Of The Year Award

January 15, 2013

Windows PowerShell 3 has won InfoWorld’s 2013 Technology of the Year award. Finally, InfoWorld editors have discovered what IT pros have known for a long time – PowerShell is simply the most powerful yet easy-to-use management tool out there on any platform! The third time is definitely the charm for PowerShell, which provides the engine […]

Read the full article →

Change mailbox audit logging age limit in Exchange 2010 and later

January 9, 2013

In Exchange 2010 and later, you can use Mailbox Audit Logging to enable auditing of mailboxes for actions taken by mailbox owners, delegates and administrators. You can log events such as mailbox access, folder access, item access, deletes, hard deletes, moves, etc. For details, see Mailbox Audit Logging in Exchange 2013 documentation. By default, mailbox […]

Read the full article →

Remove a mobile device from your Exchange account

December 20, 2012

Most users switch to new mobile devices or add new ones. Over a period of time, your Exchange mailbox may have quite a few mobile devices. If you’re not using a smartphone or other Exchange ActiveSync (EAS) device (including Windows 8/Windows RT tablets, Apple iPad or other iOS devices), you can remove it from your […]

Read the full article →

WMF 3.0, Microsoft Exchange and patch management

December 18, 2012

Last week Microsoft released Windows Management Framework 3.0, a key management component that includes WinRM 3.0 and Windows PowerShell 3.0. If you’ve been running a version of Exchange 2007 or later, you may already know that these components (PowerShell for Exchange 2007, and both WinRM 2.0 and PowerShell 2.0 for Exchange 2010) are prerequisites for […]

Read the full article →

Create bulk mailboxes in Exchange 2010 (or Exchange 2013/Exchange 2007)

December 4, 2012

I used to save code snippets as blog posts earlier. Resuming the practice, so don’t be alarmed by lack of text in this post. If you want to see detailed posts about creating bulk mailboxes, check out these previous posts: Bulk mailbox-enabling users using Exchange Shell in Exchange 2010 and Exchange 2007 Exchange Server 2007: […]

Read the full article →

Exchange 2010: Change security groups to distribution groups

August 3, 2012

Distribution groups are a well-known concept for Exchange admins. Quite simply, a distribution group is an Active Directory group that’s Exchange-enabled and therefore has an email address. Messages sent to the group are delivered to group members, which can be mailbox users, mail users (users with an email address outside the Exchange org), mail contacts, […]

Read the full article →