相关疑难解决方法(0)

PowerShell说"在这个系统上禁用了脚本的执行."

我正在尝试运行从命令提示符调用PowerShell脚本的.cmd文件,我收到以下错误:

无法加载Management_Install.ps1,因为在此系统上禁用了脚本的执行.

我跑了cmd.exe,当我Management_Install.ps1从PowerShell 运行时,我Get-ExecutionPolicy回来了.

// Powershell的输出

PS C:\ Users\Administrator> get-executionpolicy

无限制

//从DOS输出

C:\ Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scr

ipts> powershell.\ Management_Install.ps1 1

警告:运行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

按任意键继续 ...

该系统是Windows Server 2008 R2.

我究竟做错了什么?

powershell windows-server-2008-r2

1545
推荐指数
30
解决办法
193万
查看次数

使用Powershell作为IntelliJ IDEA IDE中的终端,如PyCharm,PHPStorm或RubyMine

我一直试图在pycharm中运行PowerShell作为我的终端,所以我做了以下事情:

在此输入图像描述

但是,当我尝试这个时,它说它无法执行我的脚本,因此我收到以下错误:SecurityError并且完全合格的ID是:UnAuthorizedAccess.

这是因为pycharm的终端无法执行我的Powershell_profile.ps1配置文件.

如何使用Powershell成功运行Pycharm的终端?

我到目前为止所尝试的是进入我的主要powershell目录%windir%/system32/WindowsPowerShell/1.0/profile.ps1,然后将其更改为包含以下内容:

Set-ExecutionPolicy Unrestricted
Run Code Online (Sandbox Code Playgroud)

但是,这没有帮助,当我尝试打开pycharm的终端时,我得到了同样的错误.

我也尝试将pycharm作为Admin运行,但是这也没有解决问题,我得到了同样的错误.

powershell intellij-idea pycharm

39
推荐指数
6
解决办法
3万
查看次数

从php执行Powershell脚本

我正在尝试从PHP执行powershell脚本,但它似乎不起作用.

脚本'newEvent.ps1'在Exchange服务器上创建一个事件.

$psPath = "powershell.exe";
$psDIR = "C:\\wamp\\www\\ant\\assets\\ps\\";
$psScript = "newEvent.ps1";
$runScript = $psDIR. $psScript;
$runCMD = $psPath." ".$runScript." 2>&1"; 

echo "\$psPath  $psPath <br>";
echo "\$psDIR  $psDIR <br>";
echo "\$psScript  $psScript <br>";
echo "\$runScript  $runScript <br>";
echo "\$runCMD   $runCMD  <br>";

exec( $runCMD,$out,$ret);

echo "<pre>";
print_r($out);
print_r($ret);
echo "</pre>";
Run Code Online (Sandbox Code Playgroud)

它输出:

$psPath powershell.exe
$psDIR C:\wamp\www\ant\assets\ps\
$psScript newEvent.ps1
$runScript C:\wamp\www\ant\assets\ps\newEvent.ps1
$runCMD powershell.exe C:\wamp\www\ant\assets\ps\newEvent.ps1 2>&1

Array
(
    [0] => File C:\wamp\www\ant\assets\ps\newEvent.ps1 cannot be loaded because the execut
    [1] => ion of scripts is disabled …
Run Code Online (Sandbox Code Playgroud)

php powershell exchange-server shell-exec

12
推荐指数
1
解决办法
5万
查看次数