Simple way to temporarily bypass PowerShell execution policy

One of the PowerShell challenges challenges I am constantly confronted with is dealing with running scripts on systems is blocked due to the security policy.  This is particularly cumbersome while writing or debugging new scripts.  Normally it is prudent to avoid lowering the overall security of the system by using the Set-ExecutionPolicy cmdlet and I often forget to return the system to the default state when done.  There is a simple way to solve this problem.

From the run dialog (or command prompt) just execute “powershell –ExecutionPolicy Bypass” and it will start a PowerShell session that allows for running scripts and keeps the lowered permissions isolated to just the current running process.

Comments

  • Anonymous
    January 01, 2003
    Heya, does this function at all against remote hosts? I assume no but wondered if you have any knowledge of the case.
    Thanks for sharing! I'll use this plenty at home I'm sure either way.
  • Anonymous
    August 21, 2014
    Very helpful. Thanks a ton for sharing your knowledge
  • Anonymous
    January 30, 2015
    i want to use this in gwmi -Class Win32_QuickFixEngineering -Filter {HotFixID = "KB2614066"}
    what would be the format?
  • Anonymous
    August 06, 2015
    Mack, have you tried:
    Get-Hotfix -Id "KB2614066"
  • Anonymous
    March 21, 2016
    Very useful, thanks!