Can't install local copy of MSI with msiexec, but can over the network with psexec

2

I'm not sure why this is the case, but I can't install a local copy of a MSI if I remote into the machine in PowerShell with msiexec. I get this error:

[computername]: PS C:\temp> msiexec -q -i installer.msi
T h i s   i n s t a l l a t i o n   p a c k a g e   c o u l d   n o t   b e   o p e n e d .     V e r i f y   t h a t   t h e   p a c k a g e   e x i s t s   a n d   t h a t   y o u   c a n  
 a c c e s s   i t ,   o r   c o n t a c t   t h e   a p p l i c a t i o n   v e n d o r   t o   v e r i f y   t h a t   t h i s   i s   a   v a l i d   W i n d o w s   I n s t a l l e r   p 
a c k a g e .

(I'm also not sure why it gets the extra spacing in there.)

However, I have no issues installing it from the network using psexec like this:

psexec -s \\computername msiexec -i -q \\networkpath\to\installer.msi

I've made sure that the local copy isn't blocked, so I'm not sure what's causing this.

How can I copy a MSI to the machine, and install it from within a remote session? Or is psexec the best way to do this?

supercheetah

Posted 2015-03-31T17:49:24.940

Reputation: 836

Answers

1

Here is the answer that solved the problem for me:

If you tried running the following command from within the folder containing the msi file:

msiexec /i .\package-to-install.msi /qn

If you used tab-completion, (waves at my Linux bros & sistas!) Power-shell includes the filename with the innocuous-looking .\, which causes the oddly-spaced error message to appear.

Delete the .\ in front of the .msi filename

The command would then be:

msiexec /i package-to-install.msi /qn

As a reference, this information was found here.

vigilantwindy

Posted 2015-03-31T17:49:24.940

Reputation: 13

Welcome to the super user community! I added the extra info from the link you provided. This is to prevent people in the future from NOT clicking on a dead link. (Link rot) – Tim_Stewart – 2018-04-04T21:09:44.490

0

Are you running a 64-bit machine by any chance? I have seen this issue before where I was running powershell on a local 32-bit desktop and executing a 64-bit MSI Installer across a network.

Try sticking this at the top of your script and see what happens:

    if ($pshome -like "*syswow64*") {
    & (join-path ($pshome -replace "syswow64", "sysnative") powershell.exe) -file (join-path $psscriptroot $myinvocation.mycommand) @args
    exit
}

Fazer87

Posted 2015-03-31T17:49:24.940

Reputation: 11 177

0

I should have posted this so much earlier, but I've found that in PowerShell, it's best to pass the full path to the package (in quotes, of course, if there are spaces):

[computername]: PS C:\cwd doesn't matter> msiexec -q -i "c:\path to\the package\Software Name.msi"

I'm guessing that msiexec isn't able to read the current directory from PS.

supercheetah

Posted 2015-03-31T17:49:24.940

Reputation: 836

-1

Corrected version:

psexec -s \\computername msiexec /i /q \\networkpath\to\installer.msi

Note /i and /q in place of -i and -q.

Mazhar Ali

Posted 2015-03-31T17:49:24.940

Reputation: 1