View Full Version : Session.Property - What am I doing wrong?

11-08-2010, 11:21 AM
I have created a property in the Property Manager called "REPLACE_SCHEDULER_CONFIG" with an initial value of 0 (Zero).

In a deferred custom action scheduled for After InstallInitialize I run the following function:

Function ReplaceConfig()
sConfig = LCase(readFile(sConfigPath))

If Len(sConfig) > 0 then
If InStr(1, sConfig, "Scheduler Service 2.0") then
Session.Property("REPLACE_SCHEDULER_CONFIG") = 0
Session.Property("REPLACE_SCHEDULER_CONFIG") = 1
End If
End if
ReplaceConfig = IDSUCCESS
End Function

What I am trying to do is set the value of "REPLACE_SCHEDULER_CONFIG" depending upon the what is in the current config file.

I have also tried unsuccesfully to read the value of


in the deferred action. I have successfully read Session.ProductProperty("REPLACE_SCHEDULER_CONFIG") - but according to the documentation session.ProductProperty is read-only.

My goal is to use the value of REPLACE_SCHEDULER_CONFIG as a condition of putting a new configuration file on the users system.

Does anyone know what I am doing wrong - or how I could better accomplish this?

11-08-2010, 12:21 PM
As usual - after struggling for hours I post a question - and then figure it out. Harumph...
There appear to be numerous problems.

1. In order to access session.property I need Immediate Execution, not Deferred.
2. The value that I'm assigning to the session.property needs to be a string value: "1" not 1.

Now it appears to work.

11-09-2010, 01:33 AM
Using Session.Property to fetch Property values in a Deferred CA will not work. Only a few Installer properties are available in the deferred mode.

You need to look into CustomActionData. This provides us with a method to access custom properties during deferred mode.