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

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

    I had a similar issue and noted that the default cmd on Windows Server 2012, was running the x64 one.

    For Windows 7, Windows 8, Windows 10, Windows Server 2008 R2 or Windows Server 2012, run the following commands as Administrator:

    x86 (32 bit)
    Open C:\Windows\SysWOW64\cmd.exe
    Run the command powershell Set-ExecutionPolicy RemoteSigned

    x64 (64 bit)
    Open C:\Windows\system32\cmd.exe
    Run the command powershell Set-ExecutionPolicy RemoteSigned

    You can check mode using

    • In CMD: echo %PROCESSOR_ARCHITECTURE%
    • In Powershell: [Environment]::Is64BitProcess

    References:
    MSDN - Windows PowerShell execution policies
    Windows - 32bit vs 64bit directory explanation

提交回复
热议问题