Running powershell script from explorer = execution policy error

  • On Windows 7 final I did: Set-ExecutionPolicy Unlimited
  • In Windows Explorer I select the script.ps1 file, select open with, put c: \ windows \ system32 \ WindowsPowerShell \ v1.0 \ powershell.exe
  • Powershell window briefly blinks with an error about execution policy.

The scripts are executed perfectly from within powershell. How can I launch them from Windows Explorer?

+2


source to share


2 answers


I understood that. The "about_Execution_Policies" reference element contained hints. The process execution policy should be more restrictive, which overrides the localmachine policy that was set by the standard Set-ExecutionPolicy command.



Group Policy reverses all of this. You get the template to install from microsoft , ignore the part of the page that says this only applies to win xp, this is wrong. This help file and above contains the rest of the necessary instructions.

+2


source


Are you sure this is an execution policy error? If it's PowerShell v2, try including the parameter -File

before the filename:



"C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -File "%1"

      

+4


source







All Articles