8
$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
실행되는 코드입니다
Start-Process : This command cannot be executed due to the error:
Access is denied.
한 줄의 코드를 실행하려고 다음과 같은 오류를 얻고을 제공 한 경우에도 로컬로 실행시,하지만 VBS WMI를 통해 호출하지 않을 경우
- 이 코드는 잘 작동
- 두 컴퓨터가 같은 도메인 주소 범위에 존재 공급
- 사용자 이름과 암호는 내가 함께하고 특권되고 있지만 어느 작품 인해 사용자에게
-wait
없이 모두 시도 - 두 시스템에 대한 관리자 권한을 가지고, 나는 그것이
나는 기다리지 않고 시도했다. 동일한 오류 – mhopkins321
그러나, 심지어 - 대기와 함께, 내가 사용하는 사용자 이름과 비밀 번호는 상자에 대한 전체 액세스 권한을 가지고 있으므로 관리자 권한이 필요하지 않아야합니다 – mhopkins321