remoting inconsistency.

i’m an admin on a remote server where I’ve dropped an MSI into c:\scripts.

if I go into a pssession on SERVER, I can just run

.“c:\scripts\mymsi - fun.msi” ‘/qn’

and the software gets installed.

but

invoke-command SERVER {.“c:\scripts\mymsi - fun.msi” ‘/qn’}

doesn’t do anything (from my workstation, outside of the possession).

What about this?

$Session = New-PSSession SERVER
Invoke-Command $Session { & 'c:\scripts\mymsi - fun.msi" /qn }
# Confirm it's finished
$Session | Remove-PSSession

Alternatively, what about this?

Invoke-Command SERVER { Start-Process 'c:\scripts\mymsi - fun.msi' -ArgumentList '/qn' -Wait }

actually I was wrong. the pssession version in my original post is only working on one server. nothing so far in this thread has worked on any other server.

both my pssession version and your invoke-command work on the original server I tested. they take about 10 seconds, and I can see the msinstaller events in the application log on the target server for the software getting installed.

neither my pssession version, your pssession version, or my invoke-command version have any affect on the original target server I was testing.

but and none of them work on any other server besides the original target server I was testing. ugh.

What OS is the remote server? Do you have any other servers besides the two you’ve mentioned you can test it on?

Also, have you tried calling it with msiexec.exe instead of with the MSI directly:

$Proc = Start-Process msiexec -ArgumentList '/i', 'c:\scripts\mymsi - fun.msi', '/qn' -PassThru
while (-not $Proc.HasExited) { Start-Sleep -Seconds 10 }
'Exit code: {0}' -f $Proc.ExitCode

Does it work from a terminal if you’re logged in directly to the server?

now this line from your pssession suggestion:

Invoke-Command $Session { & 'c:\scripts\mymsi - fun.msi" /qn }

is giving me “cannot run a document in the middle of a pipeline”

but yours has a single opening quote and double closing quotes

Whoops. Yeah, that’s my bad. One of the quotes needs to be changed to match the other one.

i’m getting the error even with the quotes corrected.

Then I’m not sure what’s going on. Did you try the last suggestion to call msiexec.exe? Also, what version of Windows and PowerShell are you running on the problem server?

pumping the brakes here after running it locally on a trouble server. the MSI’s “publisher can’t be verified.” I re-thought how I was putting the msi file onto the machines.

this seems to be working now.
Invoke-Command SERVER { Start-Process ‘c:\scripts\mymsi - fun.msi’ -ArgumentList ‘/qn’ -Wait }

thank you for your help.