PHP | Powershell | shell | exec()|权限不足

PHP | Powershell | shell | exec()|权限不足,php,shell,powershell,exec,Php,Shell,Powershell,Exec,我正在尝试开发一个PHP应用程序,它通过shell_exec执行Powershell命令 然而,一旦命令被执行,它就不工作了,因为它说它没有权限。你知道我要做什么吗 我的代码: $psscriptpath = "C:\inetpub\htdocs\school_panel\scripts\change.ps1"; $cmdlet = "powershell.exe -executionpolicy remotesigned -File {$psscriptpath} -usern

我正在尝试开发一个PHP应用程序,它通过shell_exec执行Powershell命令

然而,一旦命令被执行,它就不工作了,因为它说它没有权限。你知道我要做什么吗

我的代码:

    $psscriptpath = "C:\inetpub\htdocs\school_panel\scripts\change.ps1";
    $cmdlet = "powershell.exe -executionpolicy remotesigned -File {$psscriptpath} -username {$username} -password {$password} < NUL";
    echo $cmdlet;           
    $output = shell_exec($cmdlet);
    echo $output;
出现以下错误消息:

powershell.exe -executionpolicy remotesigned -File C:\inetpub\htdocs\school_panel\scripts\change.ps1 -username testingacount -password TestingTest321 < NULSet-ADAccountPassword : Access is denied
At C:\inetpub\htdocs\school_panel\scripts\change.ps1:18 char:22
+ Set-ADAccountPassword <<<<  $username -NewPassword $newpwd -Reset
    + CategoryInfo          : PermissionDenied: (testingacount:ADAccount) [Set-ADAccountPassword], UnauthorizedAccessException
    + FullyQualifiedErrorId : Access is denied,Microsoft.ActiveDirectory.Management.Commands.SetADAccountPassword
我已经尝试过的:

在两个版本的powershell上都将执行策略设置为“无限制” 为IUSER for CMD、Powershell、PHP-cgi.exe、PHP.exe和包含网站的文件夹授予完全权限 重新排列并使用代码进行各种更改。
不管我怎么想,允许web服务器/引擎直接在shell中运行命令都是一个坏主意。允许上述命令以高权限运行是一个更糟糕的想法

来源:查看第三季度的详细信息。它指的是unix root用户,但我猜root启动->fork to nobody用户系统是在多个平台上的多个Web服务器之间共享的