Azure Powershell启动过程:由于错误,无法执行此命令:访问被拒绝 [英] Azure Powershell Start-Process : This command cannot be executed due to the error: Access is denied

查看:86
本文介绍了Azure Powershell启动过程:由于错误,无法执行此命令:访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了以下代码&由于执行powershell.exe时启动过程的访问被拒绝错误而失败.

I created the below code & its getting failed because of the access denied error for start process while executing powershell.exe.

$username = "domain\username"

$password = "Welcome1234$"

$PSArgs = "D:\test.ps1"

$securePassword = ConvertTo-SecureString $password -AsPlainText -Force

$credential = New-Object System.Management.Automation.PSCredential $username,

$securePassword

Start-Process Powershell.exe -Credential $credential $PSArgs

错误:

Start-Process : This command cannot be executed due to the error: Access is denied  
Start-Process : This command cannot be executed due to the error: Access is denied.
At C:\Windows\system32\config\systemprofile\AppData\Local\Temp\PRISMA-AMR-JOB1-87-ScriptBuildTask-8569094554411403512.ps1:38 char:18
+     Start-Process <<<<  C:\Windows\System32\cmd.exe -arg "/C" -Credential $credential + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

推荐答案

Start-Process:由于错误,无法执行此命令:访问被拒绝.在C:\ Windows \ system32 \ config \ systemprofile \ AppData \ Local \ Temp \ PRISMA-AMR-JOB1-87-ScriptBuildTask-8569094554411403512.ps1:38字符:18

Start-Process : This command cannot be executed due to the error: Access is denied. At C:\Windows\system32\config\systemprofile\AppData\Local\Temp\PRISMA-AMR-JOB1-87-ScriptBuildTask-8569094554411403512.ps1:38 char:18

根据此错误代码,您似乎尚未将用户域\用户名"添加到本地计算机策略->用户权限分配中.

According to this error code, it seems you have not add your user "domain\username" to local computer policy -> User Rights Assignment.

有关用户权限分配的更多信息,请参考此

More information about User Rights Assignment, please refer to this link.

此外,在类似情况下,请参考

Also, here a similar case, please refer to it.

注意:

要打开本地组策略,请在命令提示符下或在搜索"中键入 gpedit.msc ,然后单击确定"或按 ENTER .

To open the Local Group Policy, at a command prompt or in Search, type gpedit.msc, and then click OK or press ENTER.

这篇关于Azure Powershell启动过程:由于错误,无法执行此命令:访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆