Sub Add_ActiveSetup ''''''''''''''''''''''''''''''''''''''''''''''''''''''' '' Macro to Add ActiveSetup to the current package '' ''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Check if the Feature "CurrentUser' Already Exists feature = 0 Set tblFeature = Wtables("Feature") Set featureRows = tblFeature.WRows For Each featureRow In featureRows If (featureRow("Feature") = "CurrentUser") Then feature = 1 End If Next If (feature <> 1) Then AddNewFeature=AddFeature ("CurrentUser","","CurrentUser","",1,1,"",32) feature = 1 End If 'Once the Feature does exist Continue with creating the ActiveSetup If (feature > 0) Then 'Check if the Component "ActiveSetup" Already Exists component = 0 Set tblComponent = Wtables("Component") Set componentRows = tblComponent.WRows For Each componentRow In componentRows If (componentRow("Component") = "ActiveSetup") Then component = 1 End If Next If (component <> 1) Then AddNewComponent=AddComponent ("ActiveSetup","AppDataFolder","",0) AddNewComponentToFeature=AddComponentToFeature ("ActiveSetup","CurrentUser") component = 1 End If 'Once the Component does exist continue with creating the ActiveSetup If (component > 0) Then version = GetProperty("ProductVersion") version = Replace(version, ".", ",") ' Replace periods with commas version = Replace(version, " ", "") ' Remove all spaces UPAddRegistryvalue = AddRegistryValueex(2, "Software\Microsoft\Active Setup\Installed Components\[ProductCode]", "Version", version, 0, 3,"ActiveSetup", 1, comp) UPAddRegistryvalue = AddRegistryValueex(2, "Software\Microsoft\Active Setup\Installed Components\[ProductCode]", "ComponentID", "[ProductName]", 0, 3,"ActiveSetup", 1, comp) UPAddRegistryvalue = AddRegistryValueex(2, "Software\Microsoft\Active Setup\Installed Components\[ProductCode]", "StubPath", "[SystemFolder]msiexec.exe /fup [ProductCode] /qn", 0, 3,"ActiveSetup", 1, comp) End If End If End Sub