1
在PowerShell中,远程运行的进程(软件安装):WMICLASS.Create(),返回变量?
$computers = Get-Content "C:\computer.txt"
foreach ($computer in $computers) {
#The location of the file
$Install = "\\$computer\C$\Software"
#The Install string can have commands aswell
$InstallString = "$Install\IE11-Windows6.1-x64-en-us.exe $arguments"
([WMICLASS]"\\$computer\ROOT\CIMV2:Win32_Process").Create($InstallString)
#Output the install result to your Local C Drive
Out-File -FilePath c:\installed.txt -Append -InputObject "$computer"}
有没有办法返回变量或本安装状态?或者等到这个过程完成了?
我尝试这一点,但有一个不过程中发现的。你确定这可以在远程PC上工作,或者是'Wait-Process'搜索本地PC吗? – Zeno
@Zeno对不起,没有注意到,更新回答 –
也没有运气,这是返回'Get-Process:无法连接到远程机器.'即使该过程确实开始 – Zeno