Jump to content

MSIExec works in SciTE, fails compiled?


Recommended Posts

Hey, everybody.

I'm trying to write a script to automate the installer of a piece of educational software on our Windows 7 Pro x64 machines at work. The company provides an MSI, but I need to pass a product key in and do some cleanup afterward.

So I wrote this:

Local $sn = FileRead(@ScriptDir&"\Serial Number.txt")
RunWait('msiexec.exe /i "'&@ScriptDir&'\Install.msi" /qb PIDKEY="'&$sn&'"')
DirCreate(@DesktopCommonDir&"\Jolly Phonics for Whiteboard")
FileMove(@DesktopCommonDir&"\JP Whiteboard - Step 1 - US Precursive.lnk", @DesktopCommonDir&"\Jolly Phonics for Whiteboard\Step 1.lnk")
FileMove(@DesktopCommonDir&"\JP Whiteboard - Step 2 - US Precursive.lnk", @DesktopCommonDir&"\Jolly Phonics for Whiteboard\Step 2.lnk")
FileMove(@DesktopCommonDir&"\JP Whiteboard - Step 3 - US Precursive.lnk", @DesktopCommonDir&"\Jolly Phonics for Whiteboard\Step 3.lnk")

This works perfectly fine when I run ("Go") it from within SciTE. I can also take the RunWait line (with the MSI path and serial number filled in, of course) and run it at the command line, and it installs fine. When I compile the AutoIt to an EXE, however, I get this when I try to run it:

"The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance."

Tried compiling it both as x86 and as x64 (x64 Windows 7 VM), no difference.

Tried standard fixes for this problem from Microsoft, no difference.

There's obviously something I'm missing here. Any help you can offer would be greatly appreciated!

Link to comment
Share on other sites

So I remembered that I do have another Win 7 box in the house (my personal machine) so I moved the stuff over there, and I'll be dipped if it doesn't all work perfectly. Obviously something hosed up in my VM. And no known-good snapshots (SSD, space at a premium)...oh, well.

Thanks!

Link to comment
Share on other sites

  • Moderators

Hi, MacPrince, welcome to the forum. Software repackaging and MSI manipulation is a lot of what I do. Typically, I would favor ShellExecuteWait over RunWait for an MSI install, just personal preference. Also, depending on the size of the MSI, you may look into using FileInstall to simply include the MSI in your compiled script. Here are my suggestions on your posted script above:

Local $sn = FileRead(@ScriptDir&"Serial Number.txt")<====Why not simply put the serial number in?
ShellExecuteWait("msiexec.exe", '/i "Install.msi" /qb PIDKEY="<serialNumber>"')
FileMove(@DesktopCommonDir&"JP Whiteboard - Step 1 - US Precursive.lnk", @DesktopCommonDir&"Jolly Phonics for WhiteboardStep 1.lnk", 9)
FileMove(@DesktopCommonDir&"JP Whiteboard - Step 2 - US Precursive.lnk", @DesktopCommonDir&"Jolly Phonics for WhiteboardStep 2.lnk", 9)
FileMove(@DesktopCommonDir&"JP Whiteboard - Step 3 - US Precursive.lnk", @DesktopCommonDir&"Jolly Phonics for WhiteboardStep 3.lnk", 9)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...