Thursday 4 June 2015

Accessing PUBLIC Property in Deffered Mode Custom Action - Advance Application Packaging

Step 1 :
Create PUBLIC property/Properties with needed Name-Value

In My example Im taking HOSTNAME , HOST1 & HOST2 as a three propeties.

Step 2 :
Create Set Property CA (Type51)

In my example Im am creating "SetPropForDefferedAccess"

Property Name - To identify the Propertys further by deffered CA (Here Set_PROPERTY)

Property Value - Give the list of properties you want to access in deffered mode [HOSTNAME];[HOST1];[HOST2]

CA Sequence should be set after Install Initialize


Step 3 :
Create New CA- VBscript stored in CA OR any other you need

In my example Im using VBScript stored in Custom action and named as "Set_PROPERTY"
NOTE : This CA name must be identical with the Property name mentioned in Set Property CA (Step 2)

Sequence should be set before Install Finalize




In Script use below code to fetch public property :

Option Explicit
on error resume next

Dim objShell,objFSO
Dim Test,Prop1,Prop2,Prop3
Dim PropArray

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

'To Access Single Property
Test=Session.Property("CustomActionData")
Msgbox Test

'To Access Multiple Properties
PropArray = Split(Session.Property("CustomActionData"), ";")
Prop1 = PropArray(0)
Prop2 = PropArray(1)
Prop3 = PropArray(2)
msgbox Prop1 & " " & Prop2 & " " & Prop3


Please add your comments just to addup more knoweledge about article.

Thanks for the reading :)