ScioSoft's Community Blogs Optimized IT musings for the technically inclined

Launch PowerShell Script from Shortcut

by James Fielding 4. October 2011 21:42

PowerShell is a great system management tool, and can help administrators to quickly perform tasks and collect information.

One frustration many users have with PowerShell is, unlike traditional .bat files, .ps1 files will not run by default due to PowerShell's enhanced security. Now this is OK when you’re dealing with a couple of machines, as a quick PowerShell one-liner at the prompt will fix things up for you:

 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

But, when you're dealing with a large number of machines, and/or you'd prefer to keep PowerShell’s security settings in place, here's a quick workaround. Run the script via a shortcut that temporarily allows the script to run:

  • In Windows Explorer, create a new shortcut. It doesn’t matter what your shortcut’s target is, as we’ll change that momentarily.
  • Right-click on your new shortcut, and choose “Properties”.
  • Change the shortcut’s Target to the following:
    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "E:\Scripts\MyScript.ps1" 
    Where “E:\Scripts\MyScript.ps1” is the path to the script you want to run.
  • Click “OK”.

From here, you just need to double-click your shortcut to run your script.

Sometimes you won’t want the command window to provide output. For example, say your scripts outputs to a text file. If this is the case, simply add:

-WindowStyle Hidden

Also, if you are using this on machines that could potentially have an altered Powershell profile, you'll likely want to add:


I often use this trick to run .ps1 scripts locally via a USB flashdrive. For each set of scripts that I need to run, I have a shortcut. Then, I just plug in the flashdrive, and double-click the shortcut. This way, you can quickly run scripts locally on multiple machines. Try it out!

Happy PowerShell Shortcutting,
James Fielding

Sciosoft Systems is a Canadian web design & development company based in Muskoka, which is in central Ontario. We provide ASP.NET website & Windows Server application development services to small and medium-sized business, as well as local government and not-for-profit groups. If you have a website project you’d like to discuss, please visit us at

Share |



Comments (4) -

Jeffery Hicks
Jeffery Hicks United States
10/5/2011 8:11:22 AM #

There's a security reason why you can't launch a PowerShell script by clicking it. But this is a decent alternative. The Bypass execution policy will allow you to run a script, even if the machine's policy is restricted. "Bypass" means that you have taken other means to ensure the script's integrity and intention. Since you are creating the shortcut manually, the assumption is that you know what you are doing. Even so, I'd recommend locking down security on the script file itself to that it can't be modified or read by unauthorized people.

ScioJim Canada
10/18/2011 7:39:14 PM #

Hey Jeffery. You're absolutely right: You're way more secure if you digitally sign your scripts.

In this case, I made an assumption that I was talking to the script's author who was looking for a double-click way to run their script. Well, assumption is said to be "the mother of all [mess]-ups...particularly in war and IT.

HEED THIS WARNING FELLOW POWERSHELLERS: Sign your scripts, particularly if you deploy them for others to use (either locally or on a network store), lest you suffer the horrible (and embarrassing) consequences of a hacker using your code as a springboard.

Thanks Jeffery.

front load washer reviews
front load washer reviews United States
12/29/2011 7:17:10 PM #

Probably the most basic, fundamental rule in using PowerShell is that the commands all have a common format. When you remember the format, you can more easily remember the commands.

refinance ohio
refinance ohio United States
1/26/2012 5:52:57 AM #

I was talking to the script's author who was looking for a double-click way to run their script. Well, assumption is said to be "the mother of all [mess]-ups...particularly in war and IT.

Comments are closed


Comment RSS

The opinions expressed herein are the personal opinions of the contributors and do not necessarily represent the views of Sciosoft Systems Inc.