简体   繁体   中英

Run sysocmgr.exe on remote server using powershell remoting

I am unable to run remote installation of windows component on a remote server using sysocmgr.exe. It is working with psexec.exe \\\\ServerName -i sysocmgr.exe /i:%wnidir%\\inf\\sysoc.inf /u:\\\\path\\to\\components.txt but I want to achieve the same results using powershell remoting.

I have powershell remoting with WinRM working fine, but I am unable to run remotely sysocmgr.exe using PowerShell.

What I've done on both servers (local and remote):

  1. Set-ExecutionPolicy unrestricted
  2. Enable-PSRemoting - OK
  3. Set-Item WSMan:\\localhost\\Client\\TrustedHosts *
  4. I have restarted the WinRM service, and it is working

Having all this working on both servers, I set up a persistent remote session using New-PSSession:

$s = NewPSSession -ComputerName Server1

Then I tried to launch powershell script (script.ps1) which is saved on accessible share to all servers and contains:

sysocmgr.exe /i:%wnidir%\inf\sysoc.inf /u:\\path\to\components.txt

I used Invoke-Command:

Invoke-Command -Session $s -FilePath \\NetworkShare\Scripts\script.ps1

After launching the above invoke-command I can see on remote server (server1) in task manager, that sysocmgr.exe is running, but it does nothing. The windows component installation does not start ...

I tried using:

enter-pssession -computername Server1 - worked fine I tried to launch script1.ps1 and it did the same thing, I can see the sysocmgr.exe in Task Manager, but it does nothing ...

I think I am missing some parameter for interacting with desktop, like in psexec the "-i" parameter, which I cannot find in powershell ...

Thank you for your help.

我希望您的PowerShell脚本如下所示:

sysocmgr.exe "/i:${env:windir}\inf\sysoc.inf" "/u:\path\to\components.txt"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM