title: Run sysocmgr.exe on remote server using powershell remoting
body: <p>I am unable to run remote installation of windows component on a remote server using sysocmgr.exe. It is working with <code>psexec.exe \\ServerName -i sysocmgr.exe /i:%wnidir%\inf\sysoc.inf /u:\\path\to\components.txt</code> but I want to achieve the same results using powershell remoting. </p>
  
  <p>I have powershell remoting with WinRM working fine, but I am unable to run remotely sysocmgr.exe using PowerShell.</p>
  
  <p>What I've done on both servers (local and remote):</p>
  
  <ol>
  <li><code>Set-ExecutionPolicy unrestricted</code></li>
  <li><code>Enable-PSRemoting</code> - OK</li>
  <li><code>Set-Item WSMan:\localhost\Client\TrustedHosts *</code></li>
  <li>I have restarted the WinRM service, and it is working</li>
  </ol>
  
  <p>Having all this working on both servers, I set up a persistent remote session using New-PSSession:</p>
  
  <pre><code>$s = NewPSSession -ComputerName Server1
  </code></pre>
  
  <p>Then I tried to launch powershell script (script.ps1) which is saved on accessible share to all servers and contains:</p>
  
  <pre><code>sysocmgr.exe /i:%wnidir%\inf\sysoc.inf /u:\\path\to\components.txt
  </code></pre>
  
  <p>I used Invoke-Command:</p>
  
  <pre><code>Invoke-Command -Session $s -FilePath \\NetworkShare\Scripts\script.ps1
  </code></pre>
  
  <p>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 ...</p>
  
  <p>I tried using:</p>
  
  <p><code>enter-pssession -computername Server1</code> - 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 ...</p>
  
  <p>I think I am missing some parameter for interacting with desktop, like in psexec the "-i" parameter, which I cannot find in powershell ...</p>
  
  <p>Thank you for your help.</p>