【发布时间】:2012-09-12 15:32:20
【问题描述】:
我正在尝试从主机 1.2.3.3 远程执行盒子 1.2.3.4 上的 powershell 脚本
$cred = get-credential
$process = get-wmiobject -query "SELECT * FROM Meta_Class WHERE __Class = 'Win32_Process'" -namespace "root\cimv2" -computername 1.2.3.4 -credential $cred
$results = $process.Create("powershell.exe /c C:\Windows\temp\hello.ps1 arg1")
我可以看到进程正在创建(返回值为 0),但该进程在远程系统中立即终止(1.2.3.4)
我也尝试了 powershell.exe -file 选项而不是 powershell.exe /c
我尝试使用 Invoke-Command,但由于受信任的主机问题,该方法有效。 有人能解释一下吗?
【问题讨论】:
标签: powershell powershell-remoting