2

enter image description hereI am trying to execute a powershell script via batch file and constantly getting the following warning;

-> the execution policy is set to remote signed ; i also tested with Unrestricted, the same error shows up; how to get rid of this?

Darktux
  • 427
  • 6
  • 16
  • 27

2 Answers2

12

Is your ps1 script reside in a network share ? You can skip all the security process by typing set-executionpolicy bypass in a admin powershell console

or you can invoke your script by powershell.exe -executionpolicy bypass -file \\servername\share\script.ps1

Loïc MICHEL
  • 24,935
  • 9
  • 74
  • 103
5

If the same error shows up, make sure you're setting the execution policy in the right place. On a 64 bit system there will be an execution policy for both 64 and 32 bit versions of Powershell. Normally, it loads the 64 bit version for the console, but uses the 32 bit version if called from a bat file. You need to launch the 32 bit version, running eleveated, and set the execution policy for it also.

mjolinor
  • 66,130
  • 7
  • 114
  • 135