![](/img/trans.png)
[英]Access Denied on Powershell Start-Process within AzureDevOps task
[英]Start-Process: Access is denied (even though i've provided credentials
尝试执行一行代码时出现以下错误
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
-wait
但是都没有用,并且由于用户具有特权,我宁愿保留它 问:您是否尝试过没有“等待”?
查看此链接:
参数“ -wait”禁止显示命令提示符或保留窗口,直到该过程完成。 此操作可能需要管理员权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.