8
我正試圖執行的代碼行開始處理:訪問被拒絕(即使我提供的憑據
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
但是沒有作品,並且由於用戶是特權試圖管理權限,我更願意把它
我已經嘗試過無需等待。相同的錯誤 – mhopkins321 2012-08-09 17:09:48
但是,即使使用-wait,我使用的用戶名和密碼也有完全訪問權限,因此它不應該是一個需要管理員權限的問題 – mhopkins321 2012-08-09 19:30:18