Tom Talks Microsoft Teams and Skype for Business thoughts and news

Create a One Click Run As Shortcut with PowerShell

One of the challenges of working with so many Office 365/Windows Live ID’s/Microsoft accounts is that you are constantly logging in and out of them. You can run multiple browsers or run in incognito/private modes, but that can be a pain, and sometimes you want to be in multiple sessions concurrently. For example, you might have a personal Microsoft Account, a work account, and a Dev/Test/MSDN Tenant.

Another option is to run browser instances as different windows users using “Run As”. This runs the browser as a whole different user keeping the session, cookies etc. isolated.


However creating a user account, and then running the browser with the shift right click and “Run as a different user” and then entering the account details is a pain. Fortunately PowerShell to the Rescue. I’ve created a PowerShell module that sets this up for you. It creates a new windows account and an application shortcut on the desktop. The Shortcut actually runs a PowerShell script which then runs the target application as the given user account, meaning you don’t need to enter a password every time you launch the application.

The end result is a shortcut that runs as the user, making it easy to have a browser instance for each of your accounts.

Here is the module:


Username and Password are for the local account that will be created

Module Path defines the module path, as this module is loaded at shortcut run


Here is what the desktop shortcut is actually running:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe  -command “& Import-Module ‘C:\Dropbox\PowerShell\Published\PowerShellRunAs’ ; PowerShell-RunAs -UserName msft -Password Password123 -Program ‘C:\Program Files\Internet Explorer\iexplore.exe’ -Verbose”

It’s actually running PowerShell, loading the module, then running the PowerShell-RunAs Function with the username, password and the application as parameters. It’s not the most secure thing in the world having the password in plain text I know.

I’ve not tested it extensively, but it works ok for me on Windows 8.1/10. If you hit an issue, the PowerShell window will likely launch and close too quickly to read, but you can paste that command into another PowerShell window to see what’s going on.

Note in 64bit Windows 10 you might need to explicitly run C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe as administrator and set the execution policy as unrestricted.


About the author

Tom Arbuthnot

Tom Arbuthnot is Principal Solutions Architect at Unified Communications specialist Modality Systems. He is a Microsoft Certified Master and MVP, blogger, has a regular podcast with UCToday at and is a regular speaker at events including Microsoft TechEd and Ignite. He co-runs The Microsoft UC User Group London.

1 comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tom Talks Microsoft Teams and Skype for Business thoughts and news