Unable to run powershell script on all machines in network from server machine
This question already has an answer here:
Remote computers need to have their execution policy changed to allow the script to run. It's the same thing you probably had to do to run the script on the host computer during testing.
This can be accomplished via Group Policy or manually (on all of the computers).
Using PSExec you might be able to set the policy on individual computers by running the Set-ExecutionPolicy cmdlet.
将您的powershell行更改为绕过本地执行策略:
powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File "C:file.ps1"
链接地址: http://www.djcxy.com/p/29086.html
上一篇: 从c#运行Powershell脚本