Launching a PowerShell Script Externally

To launch a PowerShell script outside of the PowerShell console (i.e. as scheduled task or as a link), prepend the script path with this:

Powershell.exe -noprofile -executionpolicy Bypass c:\pathtoscript.ps1

As you can see, in v.2 Microsoft added an -executionPolicy parameter, which allows you to override whatever execution policy is set by default. However, your call cannot override this setting if the execution policy was defined by a group policy.

Twitter This Tip! ReTweet this Tip!


Posted Mar 08 2010, 08:00 AM by ps1

Comments

Episode 105 – PSCX 2.0 with Keith Hill and Oisin Grehan « PowerScripting Podcast wrote Episode 105 – PSCX 2.0 with Keith Hill and Oisin Grehan « PowerScripting Podcast
on 03-14-2010 9:42 PM

Pingback from  Episode 105 – PSCX 2.0 with Keith Hill and Oisin Grehan «  PowerScripting Podcast

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.