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

前端 未结 30 2988
傲寒
傲寒 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:32

    Several answers point to execution policy. However some things require "runas administrator" also. This is safest in that there is no permanent change to execution policy, and can get past administrator restriction. Use with schedtask to start a batch with:

        runas.exe /savecred /user:administrator powershell -ExecutionPolicy ByPass -File script.ps1
    

    from both Jack Edmonds above, and Peter Mortensen / Dhana of post How to run an application as "run as administrator" from the command prompt?

提交回复
热议问题