【问题标题】:Azure Powershell Start-Process : This command cannot be executed due to the error: Access is deniedAzure Powershell Start-Process:由于错误无法执行此命令:访问被拒绝
【发布时间】:2017-10-06 21:14:00
【问题描述】:

我创建了以下代码,但由于执行 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

【问题讨论】:

    标签: powershell azure


    【解决方案1】:

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

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

    关于用户权限分配的更多信息,请参考这个link

    还有,这里有类似的情况,请参考it

    注意

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

    【讨论】:

    • 域用户已添加本地策略“身份验证后模拟客户端”。
    • @hans 只是检查一下提供的信息是否有用。如果您需要进一步的帮助,请告诉我。
    • @hans 我们可以与您的域用户一起运行此脚本吗?
    猜你喜欢
    • 2015-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多