Can anyone explain me how the Active Setup works ?
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

Please log in to comment
0
Create a new key here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components
add the value
stubpath (as REG_SZ)
modify value data to the line you want to excute

It will run once for every user that logs on after the install...

If it has run it will stick the same key you created above here:
HKEY_CURRENT_USER\Software\Microsoft\Active Setup\Installed Components
Answered 09/29/2006 by: gmorgan618
Blue Belt

Please log in to comment
0
I tried this as a test and it did not seem to work for some reason. Here is the test I did:

Created the following:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\Test

With a REG_SZ key set to:

StubPath="notepad"

Now shouldn't this make notepad launch on first log on on every profile on that machine? Please advise.
Answered 01/29/2007 by: dpolishsensation
Blue Belt

Please log in to comment
0
wow, this topic has come up many many times. Try the "search" function.
Answered 01/29/2007 by: turbokitty
Sixth Degree Black Belt

Please log in to comment
0
I recently found this: http://www.myitforum.com/inc/upload/8254ActiveSetupSample.MSI

It is pretty cool if you want to make your template MSI support ActiveSetup and only have to define a property value to implement ActiveSetup (if it is registry only). The only downside is there are no docs so I hope you can read VBScript so you can figure out how it works.
Answered 01/29/2007 by: kkaminsk
Ninth Degree Black Belt

Please log in to comment
0
The code kkaminsk was referring to, I haven't tested this yet, I'm just posting it to save people the trouble:

'//~~~Licensed under GPL
'//~~~http://www.gnu.org/copyleft/gpl.html
'//~~~Author:EvanJHoush evanjhoush @ hotmail.com
'//============================================================================
'//~~~ActiveSetupCustomAction
'//~~~VBScript Custom Action for use in Windows Installer packages
'//============================================================================
'//~~~This is a Generic Custom Action for use in Windows Installer (MSI)
'//~~~packages that meet the following conditions.
'//~~~1.)The package has no entry Point
'//~~~2.)The package is being installed On NT 4.0 and needs a repair to run
'//~~~ before the app launches (current user settings/or other)
'//~~~3.)The package needs some sort of custom configuration to run For each
'//~~~ user
'//~~~4.)Some other reason why it is neccessary to repair a package For each
'//~~~ user when they logon.
'//============================================================================
'//~~~Use~~~
'//~~~This custom action has been designed to be used in the following manner
'//~~~1.)Create a new Custom Action of type [38]
'//~~~2.)Copy only the vbScript portion of this file into that custom action
'//~~~3.)Add the property ACTIVESETUP to the property table and set it equal to
'//~~~ TRUE the ACTIVESETUP property may be passed as a command line
'//~~~ parameter for additional configuration flexability.
'//~~~Note:If the ACTIVESETUP property does not exist or does not = TRUE
'//~~~ this custom action will not add or remove the Active Setup Registry
'//~~~ Keys
'//~~~OPTIONAL~~~
'//~~~You may add the following properties to customize how the Active Setup
'//~~~works
'//~~~ACTIVESETUPOPTIONS = Options and propertiespassed to MSIEXEC.EXE after
'//~~~the .msi that do not deal with the install mode.
'//~~~EX. msiexec.exe /i mymsi.msi [/l*v c:\bob.log] or [ODBCSERVER="SQL01"]
'//~~~Please refer to the SDK
'//~~~
'//~~~ACTIVESETUPMODE = Options passed to MSIEXEC.EXE before the .msi
'//~~~that deal with the install mode /f[p|o|e|d|c|a|u|m|s|v] /i
'//~~~EX. The default is msiexec.exe /fu [ProductCode] /q
'//~~~This repairs current user registry entries completely silent.
'//~~~
'//~~~ACTIVESETUPCUSTOM = The full path and name of a custom exe you want to
'//~~~run instead of running msiexec.exe
'//~~~EX. ACTIVESETUPCUSTOM="c:\windows\MyCustom.EXE"
'//~~~
'//~~~ACTIVESETUPOS = The versions of Windows that you want this action to
'//~~~run on. If this property does not exist it defaults to "ALL".
'//~~~Valid values 9X NT4 W2K XP and may be concantenated for multiple OSs
'//~~~EX. NT4W2KXP or 9XNT4 or NT4W2K
'//~~~
'//~~~ACTIVESETUPREMOVE = To force removal of the Active Setup Keys in the
'//~~~Registry set this property to TRUE. **MUST be used in conjunction with
'//~~~the ACTIVESETUP property.
'//~~~
'//~~~These Properties may be set from the command line for easier testing
'//~~~and added configurability.
'//============================================================================
'//~~~Note~~~
'//~~~This Custom Action should not be used to Fix poorly built packages
'//~~~and should only be used when Standard Windows Installer methods
'//~~~fail to produce desirable results.
'//============================================================================
'//~~~Description~~~
'//This Custom Action Constructs a Registry Key in the HKLM\Software\Microsoft\
'//Active Setup\Installed Components key using Windows Installer variables.
'//Each Time a user logs On WINDOWS reconciles this HKLM key With a similar
'//key in the HKCU hive in this process the entry in the stubpath value is
'//executed by windows in the users context. Each entry reconciled is executed
'//synchronosly
'==============================================================================
'//Other documentation: Active Setup Registry Key Prototype
'[HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]]
'"ComponentID"="[ProductName]"
'"IsInstalled"=dword:00000001
'"DontAsk"=dword:00000002
'"Locale"="EN"
'"Version"="[ProductVersion]"
'"StubPath"="[SystemFolder]\\msiexec.exe /fu [ProductCode] /q"
'==============================================================================

'[~Start the program~] Session.Property("")
Option Explicit:On Error Resume Next

'//Define our variables and create our objects we will need
Private oShell :Set oShell = CreateObject("WScript.Shell")

Private sASOptions, _
sASMode, _
sASCustom, _
sASOS, _
iASVer9X, _
iASVerNT, _
sProductCode, _
sProductName, _
iProductVersion

sASOptions = Session.Property("ACTIVESETUPOPTIONS"):If sASOptions = "" Then sASOptions = " /q " : Err.Clear
sASMode = Session.Property("ACTIVESETUPMODE"):If sASMode = "" Then sASMode = " /fu " : Err.Clear
sASCustom = Session.Property("ACTIVESETUPCUSTOM"):If sASCustom = "" Then sASCustom = "False" : Err.Clear
sASOS = UCase(Session.Property("ACTIVESETUPOS")):If sASOS = "" Then sASOS = "ALL" : Err.Clear
iASVer9X = Session.Property("Version9X"): Err.Clear
iASVerNT = Session.Property("VersionNT"): Err.Clear
sProductCode = Session.Property("ProductCode")
sProductName = Session.Property("ProductName")
iProductVersion = Session.Property("ProductVersion")

Main

'~~~~~~~~~~~~~'
'~SubRoutines~'
'~~~~~~~~~~~~~'

Sub ActiveSetupRemove()
Err.Clear
'//Remove this Key - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]
oShell.RegDelete "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\ComponentID"
oShell.RegDelete "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\IsInstalled"
oShell.RegDelete "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\DontAsk"
oShell.RegDelete "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\Locale"
oShell.RegDelete "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\Version"
oShell.RegDelete "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\StubPath"
oShell.RegDelete "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\"
If Err.Number = 0 Then WriteLog "ActiveSetup entries removed"
If Not Err.Number = 0 Then WriteLog "Error removing ActiveSetup entries"
End Sub

Sub ActiveSetupCustom()
Err.Clear
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\ComponentID", sProductName, "REG_SZ"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\IsInstalled", 1, "REG_DWORD"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\DontAsk", 2, "REG_DWORD"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\Locale", "*", "REG_SZ"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\Version", iProductVersion, "REG_SZ"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\StubPath", sASCustom, "REG_SZ"
If Err.Number = 0 Then WriteLog "ActiveSetup Custom entries written"
If Not Err.Number = 0 Then WriteLog "Error writing ActiveSetup Custom entries"
End Sub

Sub ActiveSetup()
Err.Clear
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\ComponentID", sProductName, "REG_SZ"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\IsInstalled", 1, "REG_DWORD"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\DontAsk", 2, "REG_DWORD"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\Locale", "*", "REG_SZ"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\Version", iProductVersion, "REG_SZ"
oShell.RegWrite "HKLM\Software\Microsoft\Active Setup\Installed Components\" & sProductCode & "\StubPath", Session.Property("SystemFolder") & "msiexec.exe " & sASMode & sProductCode & sASOptions, "REG_SZ"
If Err.Number = 0 Then WriteLog "ActiveSetup entries written"
If Not Err.Number = 0 Then WriteLog "Error writing ActiveSetup entries"
End Sub

Sub WriteLog(sMessage)
'//I stole this code from Darwin@desktopengineer.com - Thanks Darwin!!
Dim msiMessageTypeInfo : msiMessageTypeInfo = &H04000000
Dim record : Set record = Installer.CreateRecord(1)

record.stringdata(1) = sMessage
record.stringdata(0) = "[1]"
record.formattext

message msiMessageTypeInfo, record

End Sub


Sub InstallType()
'//Check for existance of ACTIVESETUP Property and value
If UCase(Session.Property("ACTIVESETUP"))=UCase("TRUE") Then
'//Check if this is an uninstall
If UCase(Session.Property("REMOVE"))=UCase("ALL") Then
ActiveSetupRemove
ElseIf UCase(Session.Property("ACTIVESETUPREMOVE"))=UCase("TRUE") Then
ActiveSetupRemove
'//Check to see if you want to run a custom active setup command
ElseIf NOT UCase(sASCustom)=UCase("FALSE") Then
ActiveSetupCustom
Else
ActiveSetup
End If
End If
End Sub

Sub Main()

If (NOT iASVer9X = "") AND InStr(sASOS,"9X")Then
InstallType
ElseIf (iASVerNT >= 400) AND InStr(sASOS,"NT4")Then
InstallType
ElseIf (iASVerNT >= 500) AND (iASVerNT < 501) AND InStr(sASOS,"W2K")Then
InstallType
ElseIf (iASVerNT = 501) AND InStr(sASOS,"XP")Then
InstallType
ElseIf InStr(sASOS,"ALL") Then
InstallType
End If


Set oShell = Nothing
End Sub
Answered 01/30/2007 by: turbokitty
Sixth Degree Black Belt

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