Jump to content

msiexec fails with runwait


 Share

Recommended Posts

Hi,

I have a (tested & working) batch that installs Foxit reader 2.2. When I call this Batch from AutoIT, it doesn't work - but only the msiexec-line does not work properly. The msiexec-installation starts an does something (Progressbar), but for example the shortcuts in the Program-menue are missing.

The (proper working) Batch is:

msiexec.exe /i \\AUR-S-FS002\REMINST\AutoInst\FoxIt\foxitreader22.msi /passive <--This line is not proper working

copy \\AUR-S-FS002\REMINST\AutoInst\FoxIt\lang_de_de.xml "%PROGRAMFILES%\Foxit Software\Foxit Reader"

"%PROGRAMFILES%\Foxit Software\Foxit Reader\Foxit Reader.exe" -register

regedit /s \\AUR-S-FS002\REMINST\AutoInst\FoxIt\Foxit.reg

The code in AutoIT3 is:

$val = RunWait(@ComSpec & " /c " & $cmd,@TempDir,@SW_MINIMIZE)

where $cmd gets replaced by the name of the Batchfile

Has anyone an idea?

Thanks a lot

Michael

Link to comment
Share on other sites

Try

RunWait(@ComSpec & " /c start foxitreader22.msi /passive")

Line 2 - FileCopy()

Line 3 - I would try something similar to Line 1

Line 4 - I would use RegWrite() or RegDelete() instead of calling an external reg file.

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

He also asked if anyone had an idea. Mine was to write the whole thing in AutoIt and forego the batch. Should have been more clear.

Edited by ksmith247

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

Thank you very much for all the ideas.

I just got closer to the solution now. In my AutoIT Code I had this line a few lines above the RunWait command:

RunAsSet($AdminName, $DomainName, $AdminPWD)

Disabling this line makes the whole thing work fine. Now I only have to find out why.

The idea of my AutoIT script is to have a tool for us few Admins in our company that centralizes softwareinstallation (and more) and that is easy to configure (I don't want to compile the Script each time I add or change an installation, until today it worked fine for nearly 2 years). So my "AutoAdmin" manages from a simple config file all our batches (and e.g. command-lines you need twice a year an then you have forgotten what it was). Changes in the config-file are easy to be done with an editor and then it works immediately. That's the reason for splitting it into AutoIt and Batches or whatever.

Also it puts all this seperate commands into one GUI.

A few lines from the Config file:

[Prog24]

Name=FoxITReader

CMD=$INSTSERVER\REMINST\AutoInst\FoxIt\Foxit.bat $INSTSERVER\REMINST\AutoInst\FoxIt

LongText=Schneller, kleiner PDF Reader - Freeware

Link to comment
Share on other sites

I checked RunAsSet: the "Secondary Logon service" or "RunAs service" is running. Also I'm logged on with administrative rights....

I solved the Problem with

If Not IsAdmin() Then

RunAsSet($AdminName, $DomainName, $AdminPWD)

EndIf

Link to comment
Share on other sites

Hi,

I have a (tested & working) batch that installs Foxit reader 2.2. When I call this Batch from AutoIT, it doesn't work - but only the msiexec-line does not work properly. The msiexec-installation starts an does something (Progressbar), but for example the shortcuts in the Program-menue are missing.

The (proper working) Batch is:

msiexec.exe /i \\AUR-S-FS002\REMINST\AutoInst\FoxIt\foxitreader22.msi /passive <--This line is not proper working

copy \\AUR-S-FS002\REMINST\AutoInst\FoxIt\lang_de_de.xml "%PROGRAMFILES%\Foxit Software\Foxit Reader"

"%PROGRAMFILES%\Foxit Software\Foxit Reader\Foxit Reader.exe" -register

regedit /s \\AUR-S-FS002\REMINST\AutoInst\FoxIt\Foxit.reg

The code in AutoIT3 is:

$val = RunWait(@ComSpec & " /c " & $cmd,@TempDir,@SW_MINIMIZE)

where $cmd gets replaced by the name of the Batchfile

Has anyone an idea?

Thanks a lot

Michael

First, I assume $cmd contains msiexec.exe somewhere in it. msiexec.exe is a windows program and doesn't need to be run under the command processor.

Second, failing to use double quotes can cause problems. If there's spaces in the $cmd variable (there probably aren't from what I can see) the command just won't execute properly. I always use the single quote (') to enclose strings so that I have the double quote (") available to use within strings - you'll see this in my code below.

Third, rather than use regedit.exe which DOES require being run by the command processor (@comspec), regedt32.exe (in the System directory) IS a Windows program and can be run on its own - no @comspec needed.

So here's the code I propose

$InstServer = '\\AUR-S-FS002'
$InstDir = $InstServer & '\REMINST\AutoInst\FoxIt\'
$Cmd = '"' & @SystemDir & '\msiexec.exe" /i "' & $InstServer & $InstDir & 'foxitreader22.msi" /passive'
$val = RunWait ( $Cmd, $InstDir )
$Ret = FileCopy ( '\\AUR-S-FS002\REMINST\AutoInst\FoxIt\lang_de_de.xml', @ProgramFilesDir & '\Foxit Software\Foxit Reader\lang_de_de.xml', 1 )
$Ret = RunWait ( '"' & @SystemDir & '\regedt32.exe" /s "\\AUR-S-FS002\REMINST\AutoInst\FoxIt\Foxit.reg"', @SystemDir )

Note that I'm obsessive enough to enclose both msiexec as well as the msi file in double quotes to insure the proper execution of the commands. (OK, I'll admit I've NEVER seen the @systemdir have spaces in it, but like I said I can be obsessive!)

ALSO, specifying the default directory (workingdir parameter) helps insure that the command will know where it is. It shouldn't be needed in either RunWait line, but it doesn't hurt either!

The code above should work just like the batch file - even better, without that ugly command window!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...