views:

70

answers:

1

Hi,

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): - Set-ExecutionPolicy unrestricted - Enable-PSRemoting - OK - Set-Item WSMan:\localhost\Client\TrustedHosts * - 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.

A: 

I would expect your PowerShell script to look like this:

sysocmgr.exe "/i:${env:windir}\inf\sysoc.inf" "/u:\path\to\components.txt"
JasonMArcher
Unfortunately powershell can handle both types of variables, though %windir% works fine as well as the ${env:windir} but neither solved the problem. I also added the double quotes, but it is still not working ...
kubusz
PowerShell itself will not recognize "%var%". BTW, was the typo "%wnidir%" just in your post, or in your code as well?
JasonMArcher