Hello world,

I try to call a VBS script as a custom action from within an MSI
installation. But when I access the WScript object in my script, it will not
run, and the MSI installer will exit with an error message (even if the
script runs fine when called directly via wscript.exe).

I now suspect that the Windows Installer MSI system has its own scripting
host and does not use WSH so that the WScript object is not available. Am I
right?

The point why I wanted to access WScript is that I need access to the
"CustomActionData" that the MSI passes to my script. (I believed that the
"CustomActionData" is passed in form of command line arguments, and
therefore wanted to access it via WScript.Arguments.)

Could anyone please tell me how to go to access the "CustomActionData" that
is passed from MSI installers to VBS scripts? Is there a working alternative
for the WScript object?

Jens

Re: MSI: Scripting Problem by Torgeir

Torgeir
Mon Jan 19 15:34:45 CST 2004

Hi

Just a side note first: For MSI Custom Actions and VBScript, in the future you
might also get better help if you cross post (not multipost!) to the
microsoft.public.platformsdk.msi group as well (where the MSI experts hang out).

Answers inline...

Jens Lenge wrote:

> I now suspect that the Windows Installer MSI system has its own scripting
> host and does not use WSH so that the WScript object is not available. Am I
> right?

Yes.


> The point why I wanted to access WScript is that I need access to the
> "CustomActionData" that the MSI passes to my script. (I believed that the
> "CustomActionData" is passed in form of command line arguments, and
> therefore wanted to access it via WScript.Arguments.)

CustomActionData is not command line parameters per se. It is a property you can
set in the MSI file, and then you must parse it yourself in your custom action.

CustomActionData Property
http://msdn.microsoft.com/library/en-us/vsintro7/html/vxgrfCustomActionDataProperty.asp



> Could anyone please tell me how to go to access the "CustomActionData" that
> is passed from MSI installers to VBS scripts? Is there a working alternative
> for the WScript object?

You can use the Session.Property function for this, take a look here for how:

Wise KB Article #1601
HOWTO: Passing properties to VB Script in Deferred Mode
http://www.wisesolutions.com/KBArticle.aspx?articleno=1601


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: MSI: Scripting Problem by Jens

Jens
Tue Jan 20 04:40:21 CST 2004

> Just a side note first: For MSI Custom Actions and VBScript, in the future
> you might also get better help if you cross post (not multipost!) to the
> microsoft.public.platformsdk.msi group as well (where the MSI experts hang
> out).

Just BTW - by what is a xpost different from a multipost? I thought
these were two words for the same thing. Anyway, thanks for the hint!

I will have a close look at the ressources you pointed me to.

Jens


Re: MSI: Scripting Problem by Steve

Steve
Tue Jan 20 07:54:40 CST 2004

Jens Lenge wrote:
> Just BTW - by what is a xpost different from a multipost? I thought
> these were two words for the same thing. Anyway, thanks for the hint!

A multipost is sending *separate* identical messages to different groups.
Because they are separate messages, there is no link between the two threads.

Crossposting is sending the *same* message to different groups by specifying
more than one group in the Newsgroups header. Since there is only one thread,
replies in one group are replicated across all groups (unless the poster removes
them from the Newsgroups header in their reply).

Multiposting is a strict no-no; crossposting to a *limited* number of groups is
preferred. Crossposting to a multitude of groups because you're too lazy to
figure out exactly what you're asking is frowned upon.

If you crosspost to groups you normally don't read, it's considered polite to
set the Followup-To header to groups that you do. You should also mention that
followups have been set in the text of the message so that people who don't
display all message headers aren't surprised when their replies show up in
groups they didn't post to.

--
Steve

If mankind minus one were of one opinion, then mankind is no more justified in
silencing the one than the one--if he had the power--would be justified in
silencing mankind. -John Stuart Mill



Re: MSI: Scripting Problem by Jens

Jens
Tue Jan 20 09:26:32 CST 2004

Thank you for the explanation!
Jens