2

I have an .exe I would like to install on a large farm of Windows Server 2008 computers. I am attempting to use Powershell remoting. I have this command which works locally:

invoke-command {& "N:\Temp\fortify_installer\HP-Fortify-3.20-Analyzers_and_Apps-Windows-x86.exe /s /f1N:\Temp\fortify_installer\response.iss"}

But when I add the -computername flag it seems to go off to nowhere, and the installer is never run on the remote machine.

I can launch notepad.exe via the same command and it runs. Does it have something to do with it being an installer, or something else? I realize many versions of this question have been asked and I have read them, but I am still confused as to why this doesn't work.

jscott
  • 24,484
  • 8
  • 79
  • 100
  • Maybe the remote computer doesn't have an 'N:' drive? –  Dec 28 '11 at 16:35
  • also the notepad.exe works remotely? What happens when you invoke-command -computername server1 "cmd /c dir N:\temp\* > c:\windows\temp\remote.lst"? Do you have a remote.lst file on server1 which list the files on N:? Is N: a network drive htat gets mapped during logon? –  Dec 28 '11 at 18:27
  • N is a local partition, not a network drive. That command didn't work for me from the console. Didn't like the wildcard, then when I removed it said only script files are acceptable for filepath parameter, which was not even in the command.... –  Dec 28 '11 at 18:47
  • I don't see anything parameters to the installer telling it to install non-interactively. Are you sure this thing is not trying to popup some kind of interactive window on the remote machine? The remote powershell server process is non-interactive. When you run it without -computer, it is using your local interactive session. – x0n Dec 29 '11 at 03:58
  • Here is the actual command that will work locally, but not remotely: invoke-command {& "N:\Temp\fortify_installer\HP-Fortify-3.20-Analyzers_and_Apps-Windows-x86.exe /s /f1N:\Temp\fortify_installer\response.iss"} –  Dec 29 '11 at 19:12
  • Not an answer, but I would recommend starting Procmon from Sysinternals on the machine that isnt running the install correctly to see whats going on. Possible access violation, file not found etc. – floyd Jun 28 '13 at 03:43

3 Answers3

1

The invoke-command requires the remote computer to be configured for remote management. Running Remote Commands

If you are unable to configure remote management you could use Windows Management Instrumentation (WMI) for the remote execution. Execute program on remote computer using PowerShell

  • I think I have Remote Management configured on all computers. I am able to use invoke-command to do other stuff...Thanks! –  Dec 28 '11 at 17:58
  • Is your command structure? Invoke-command -Computername Server01 -Scriptblock {& "N:\Temp\fortify installer\HP-Fortify-3.20-Analyzers_and_Apps-Windows-x86.exe"} –  Dec 28 '11 at 18:34
  • I don't have -ScriptBlock in there, but other than that it is. –  Dec 28 '11 at 18:48
1

I am going off the assumption that your command in the scriptblock is correct. Does the Invoke-command complete or do you have to kill the command? Try the command and have the results returned to a variable like this:

$var = Invoke-Command -ComputerName <Computer> -ScriptBlock {& "N:\Temp\fortify_installer\HP-Fortify-3.20-Analyzers_and_Apps-Windows-x86.exe /s /f1N:\Temp\fortify_installer\response.iss"}

Everything looks ok other than I would add the -scriptblock parm for clarity. Try putting what you have in the scriptblock in a .PS1 file and then use the -filepath parm with the location of the ps1 script you just created.

This very well could be an interactive session issue but the results of your invoke-command should give this to you. Otherwise you may need to look at event logs on that remote machine and see if anything turns up there.

TechGuyTJ
  • 792
  • 1
  • 13
  • 26
1

Could you try the following:

  1. Enter-pssession to check that your remoting config works

  2. Copy the exe from N: (I'm assuming this is a mapped drive on the server) to C: or some local disk and run the script again after adjusting the path? There is a good chance double-hop authentication interferes with your script.

Trondh
  • 4,201
  • 24
  • 27