Geeks With Blogs

Arthur Zubarev Compudicted

Recently I was given a task of building an MSI package that among other things needed to include a VBScript in it. The VBScript would run at the end of the installation process.
Because I used to build install packages on and off in the past that also included various VBScripts I did not think twice, simply rolled up my sleeves and started a new Setup project in Visual Studio.
While doing an initial build I noticed that it is not so easy to incorporate some advanced features into the project as chaining other MSI packages, starting and stopping services, creating environmental variables, etc.
Finally, to my disappointment, I could not get the VBScript executed at the end of my installation package!
An error about VBScript not being able to run popped up.
What a surprise, I was tempted to blame the Visual Studio for that failure and simply decided to switch to another install tool to try.
Although this time I wanted the luxury of having a tool easy to work with that would have the features I needed and also flexible enough. After some digging into the Internet I was able to find an excellent alternative from wItem Installer2Go.
Alas, after building an MSI package this time five times as fast with it I received the same result. The script would not run!
I started to suspect something is wrong with my script and did the installation with logging turned on via command line.
Well, the error was there it was can’t create object: WScript.Shell Hmm, I puzzled for a moment and scratched my head, I was sure I had successfully deployed several MSIs with a VBScript in them before.
After some research the issue became evident: You cannot use the WScript object in scripts that are called by MSIExec.
An excellent article is this at SpinnerSoftware or a discussion thread on the Microsoft's Communities website.
This does make sense to me, one cannot have a handle to WSH from MSI.
Well, the only positive outcome is I now have a very nice Installer at hand I will be using.

Update: Justed used another approach and it works. You can instead create an executable off the same, slightly modified VBScript (only a Sub Main procedure needs to be added), the tool I used is a freeware ScriptPad.

Posted on Sunday, February 22, 2009 7:11 PM | Back to top

Comments on this post: Launching an Arbitrary VBScript From Within MSI Package

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Compudicted | Powered by: