How to get rid of security warning in Batch/Powers

2019-07-21 05:47发布

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?

2条回答
叼着烟拽天下
2楼-- · 2019-07-21 06:25

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.

查看更多
孤傲高冷的网名
3楼-- · 2019-07-21 06:37

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

查看更多
登录 后发表回答