[英]Run sysocmgr.exe on remote server using powershell remoting
我無法使用sysocmgr.exe在遠程服務器上運行Windows組件的遠程安裝。 它正在使用psexec.exe \\\\ServerName -i sysocmgr.exe /i:%wnidir%\\inf\\sysoc.inf /u:\\\\path\\to\\components.txt
但我想使用Powershell遠程處理實現相同的結果。
我的Powershell遠程處理功能與WinRM正常工作,但是無法使用PowerShell遠程運行sysocmgr.exe。
我在兩台服務器(本地和遠程)上都做了什么:
Set-ExecutionPolicy unrestricted
Enable-PSRemoting
確定 Set-Item WSMan:\\localhost\\Client\\TrustedHosts *
所有這一切都在兩台服務器上完成后,我使用New-PSSession設置了持久的遠程會話:
$s = NewPSSession -ComputerName Server1
然后,我嘗試啟動powershell腳本(script.ps1),該腳本保存在所有服務器的可訪問共享中,並且包含:
sysocmgr.exe /i:%wnidir%\inf\sysoc.inf /u:\\path\to\components.txt
我使用了Invoke-Command:
Invoke-Command -Session $s -FilePath \\NetworkShare\Scripts\script.ps1
啟動上述調用命令后,我可以在任務管理器中的遠程服務器(server1)上看到sysocmgr.exe正在運行,但是它什么也沒做。 Windows組件安裝無法開始...
我嘗試使用:
enter-pssession -computername Server1
運行正常我嘗試啟動script1.ps1,它做了同樣的事情,我可以在任務管理器中看到sysocmgr.exe,但是它什么也沒做...
我想我缺少一些與桌面交互的參數,例如在psexec中,“-i”參數在Powershell中找不到...
謝謝您的幫助。
我希望您的PowerShell腳本如下所示:
sysocmgr.exe "/i:${env:windir}\inf\sysoc.inf" "/u:\path\to\components.txt"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.