PowerShell says “execution of scripts is disabled on this system.”

前端 未结 30 2475
傲寒
傲寒 2020-11-22 00:45

I am trying to run a cmd file that calls a PowerShell script from cmd.exe, but I am getting this error:

Management_Instal

30条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 01:31

    I had the same problem today. 64-bit execution policy was unrestricted, while 32-bit was restricted.

    Here's how to change just the 32-bit policy remotely:

    Invoke-Command -ComputerName $servername -ConfigurationName Microsoft.PowerShell32 -scriptblock {Set-ExecutionPolicy unrestricted}
    

提交回复
热议问题