Hi All,

Is it possible to assign a value to a property from embedded code?

My script would look something as such...

Dim MyValue
MyValue = "Test"
[MYVALUEPROPERTY]=MyValue 'Assign property MYVALUEPROPERTY to MyValue

I'm guessing this is possible with use of the installer object (Accessing the MSI database and running an SQL statement to update the value). Short of this, is there a cleaner way?

Second question..

I have a custom action that calls a command line executable which essentially installs a Windows component. Even when it fails, it exits successfully. If I wanted to evaluate the standard output of the command, how would I go about telling Windows Installer that this custom action failed?

TIA folks.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
yes, a type 51 custom action would be much better. Also, I don't like embedded vbscript. too limiting.
Answered 02/06/2009 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
Hello aogilmor,

To which question was your response? Could you please elaborate on your answer as well as why embedded vbscript is too limiting?
Answered 02/09/2009 by: jayteeo
Purple Belt

Please log in to comment
0
Owen's answer was to your first question, but in a circular way. Basically, he's telling you to forget script and use a Type 51 Custom Action.

embedded vbscript is too limiting...because there's an upper limit to the number of characters available in the table column. Many people ignore that limit but the risk is that Microsoft might one day enforce it more rigidly (actually, read that as "at all").
Answered 02/09/2009 by: VBScab
Red Belt

Please log in to comment
0
I see. What I'm trying to accomplish is capture the standard output of an executable and assign that to a property. I don't see how that's possible without a vbscript type CA. Is he suggesting that I used a vbscript CA in combination with a type 51 CA?
Answered 02/09/2009 by: jayteeo
Purple Belt

Please log in to comment
0
No, simply use a type 51 CA; setting properties is what it does.
as for embedded vbs being too limiting, what i was meant was the character limitation (255 IIRC, although I've seen it stretched much longer, why push the envelope? if you're using a VB script CA - which should be used only if standard tools won't work -- use a proper editor and place it in the binary table).

Again, msi.chm is a great source of information.
Answered 02/09/2009 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
Hi Owen - I think you misunderstood what it is that I'm trying to do. I want to run an executable and capture the standard output of that executable then assign it to a property. For example, if I wanted to run a vbscript which calls IPConfig.exe, I want to take the output of IPConfig and assign it to a property. Like so...

Dim Output
Wshshell.Run("ipconfig > mytext.txt", 0, True)
FSO.OpenTextFile("mytext.txt")
Do Until FSO.AtEndOfStream
Output = Output & Chr(13) & FSO.ReadLine
Loop
Session.Property("MyProperty") = Output
Answered 02/09/2009 by: jayteeo
Purple Belt

Please log in to comment
0
OK I understand now. I still think there's better ways to do it. I would try a wmi script (type 6 i think) which uses the Win32_NetworkAdapterConfiguration collection or just try to find it in the registry and read it using appsearch.
Answered 02/09/2009 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
Here is something you could start with:


WScript.Echo GetIpconfigOutput()

Function GetIpconfigOutput()
Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
Dim sComSpec : sComSpec = WshShell.ExpandEnvironmentStrings("%ComSpec%") & " /c"

Dim oExec : Set oExec = WshShell.Exec(sComSpec & " ipconfig")
Do While oExec.Status = 0
'WScript.Sleep 100
Loop

Dim sOutput : sOutput = oExec.StdOut.ReadAll

GetIpconfigOutput = sOutput

Set oExec = Nothing
Set WshShell = Nothing
End Function
Answered 02/10/2009 by: AngelD
Red Belt

Please log in to comment
0
Ugh...hideous. Capturing console output is messy, error-prone and largely unnecessary these days.

Do as Owen suggested and either get the adapter info directly from the registry or use WMI.

Also, how much time would you have saved if you had explained at the outset exactly what you wanted to achieve?
Answered 02/10/2009 by: VBScab
Red Belt

Please log in to comment
0
Thanks for the input folks.

What I'm doing actually has nothing to do w/ IPCONFIG.. sorry if I didn't convey that clearly. Surely, WMI route would be the way to get the NIC's IP address cleanly. I'm actually just installing IIS on a 2k8 server using ServerManagerCmd.exe.

AngelD - as for using the standard/error output, I have to use the Run method because the window has to be hidden.
Answered 02/10/2009 by: jayteeo
Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity