Start-Process: 访问被拒绝(尽管我已经提供了凭据)

9
在执行某行代码时,我遇到了以下错误:
Start-Process : This command cannot be executed due to the error: 
Access is denied.

这是正在执行的代码

$username = "domain\username"
$passwordPlainText = "password"     
$password = ConvertTo-SecureString "$passwordPlainText" -asplaintext -force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $username,$password

$powershellArguments = "D:\path\ps.script.ps1", "arg1", "arg2", "arg3", "arg4"
Start-Process "powershell.exe" -credential $cred -ArgumentList $powershellArguments -wait
  • 当本地执行时,此代码运行正常,但通过vbs WMI调用时却不行。
  • 两台计算机存在于同一域和地址范围内。
  • 提供的用户名和密码在两台计算机上具有管理员权限。
  • 我尝试过使用和不使用-wait,但都不起作用,由于用户拥有特权,我更愿意将其保留。
1个回答

2

然而,即使使用了-wait参数,我正在使用的用户名和密码具有对该框的完全访问权限,因此它不应该需要管理员权限。 - mhopkins321

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接