我正在尝试运行从cmd.exe调用powershell脚本的cmd文件,我收到以下错误: 
无法加载
Management_Install.ps1因为在此系统上禁用了脚本的执行。
我跑了
Set-ExecutionPolicy -ExecutionPolicy Unrestricted当我从powershell运行Get-ExecutionPolicy时,我得到Unrestricted 。 
PS C:\Users\Administrator\> Get-ExecutionPolicy
UnrestrictedC:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\> powershell .\Management_Install.ps1 1
WARNING: Running x86 PowerShell...无法加载文件
C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\Management_Install.ps1因为在此系统上禁用了脚本的执行。有关详细信息,请参阅 “get-help about_signing”。在线:1 个字符:25
.\Management_Install.ps1<<<< 1
CategoryInfo:NotSpecified:(:) [],PSSecurityException
FullyQualifiedErrorId:RuntimeException
C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\> PAUSE
Press any key to continue . . .该系统是 Windows Server 2008R2。
我究竟做错了什么?
如果您使用的是Windows Server 2008 R2,那么有一个x64和x86版本的 PowerShell,这两个版本都必须设置其执行策略。您是否在两台主机上设置了执行策略?
作为管理员 ,您可以通过在 PowerShell 窗口中键入以下内容来设置执行策略:
Set-ExecutionPolicy RemoteSigned有关更多信息,请参阅使用 Set-ExecutionPolicy Cmdlet 。
您可以通过在运行 PowerShell 时添加-ExecutionPolicy ByPass来绕过此策略
powershell -ExecutionPolicy ByPass -File script.ps1我有类似的问题,并注意到Windows Server 2012上的默认cmd正在运行 x64。 
对于Windows 7 , Windows 8 , Windows 10 , Windows Server 2008 R2或Windows Server 2012 ,请以管理员身份运行以下命令:
 x86 (32 位) 
打开C:\Windows\SysWOW64\cmd.exe 
运行命令powershell Set-ExecutionPolicy RemoteSigned 
 x64 (64 位) 
打开C:\Windows\system32\cmd.exe 
运行命令powershell Set-ExecutionPolicy RemoteSigned 
您可以使用检查模式
echo %PROCESSOR_ARCHITECTURE% [Environment]::Is64BitProcess  参考文献: 
 MSDN  -  Windows PowerShell 执行策略 
 Windows  -  32 位对 64 位目录说明