Set Windows Installer Properties (REBOOT Property) to ReallySuppress using VBS and Custom Action

If you need to change a property (like REBOOT) and set it to ReallySuppress in an MSI Package, go ahead reading this post.
(Once in a while you get these crap MSIs where a CustomAction (usually with Source set to ISSetup.dll) is controlling your reboot behavior. although you set REBOOT=ReallySuppress, the CustomAction overrides this and sets the REBOOT property to FORCE.

i had the follow line in the MSI Log:

MSI (s) (0C!A0) [15:58:00:979]: PROPERTY CHANGE: Modifying REBOOT property. Its current value is ‘ReallySuppress’. Its new value: ‘Force’.

  • Add this VBS Script to the Binary Table and call it ResetRebootPropertyVbs (Column Name)
  • Add the ResetRebootPropertyVbs to the CustomAction Table, set the properties as follows:
    • Action = ResetRebootPropertyCA
    • Type = 6
    • Source = ResetRebootPropertyVbs
  • Add the Action ResetRebootPropertyCA with Condition set to Not Installed (to call id during install) or REMOVE=ALL (to call it during uninstall/removal) to the InstallExecuteSequence with Sequence set to 6500 or even higher

 

'==========================================================================
' NAME: ResetRebootProperty.vbs
'
' AUTHOR:  Christian Muggli, Solvia GmbH
' DATE  : 20100811 (YYYYMMDD)
'
' COMMENT: read the script..
'
' USAGE / Syntax: ResetRebootProperty.vbs 
' 
' CHANGE HISTORY:
' .........................................................................
' DATE of Change        Who                          What
' -------------------------------------------------------------------------
' 20100811      		Christian Muggli               Created
'==========================================================================

Option Explicit
On Error Resume Next
 
' Constants
' msiMessageType
Public Const msiMessageTypeFatalExit = &H00000000 '// Premature termination, possibly fatal out of memory.
Public Const msiMessageTypeError = &H01000000 '// Formatted error message, [1] is message number in Error table.
Public Const msiMessageTypeWarning = &H02000000 '// Formatted warning message, [1] is message number in Error table.
Public Const msiMessageTypeUser = &H03000000 '// User request message, [1] is message number in Error table.
Public Const msiMessageTypeInfo = &H04000000 '// Informative message for log, not to be displayed.
Public Const msiMessageTypeFilesInUse = &H05000000 '// List of files in use that need to be replaced.
Public Const msiMessageTypeResolveSource = &H06000000 '// Request to determine a valid source location.
Public Const msiMessageTypeOutOfDiskSpace = &H07000000 '// Insufficient disk space message.
Public Const msiMessageTypeActionStart = &H08000000 '// Start of action,
' own
Public Const strLogFilePrefix = "Solvia GmbH Logging : "
 
WriteToMsiLog "Custom Script with Name: " & WScript.ScriptName & " started"
 
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim lRet, strFolder, strRebootProperty
strFolder = Session.Property("TARGETDIR")
WriteToMsiLog "determined TARGETDIR Property.. Resolved to: " & strFolder
WriteToMsiLog "REBOOT Property: " & Session.Property("REBOOT")
WriteToMsiLog "will set REBOOT Property to ReallySuppress (R)..."
Session.Property("REBOOT")="ReallySuppress"
WriteToMsiLog "REBOOT Property: " & Session.Property("REBOOT") 
 
Function WriteToMsiLog(strMessage)
                Dim objMessage
                Set objMessage = Session.Installer.CreateRecord(0)
                objMessage.StringData(0) = strLogFilePrefix & strMessage
                'If Session.Property("CUSTDEBUG") <> "" Then MsgBox "Message: " & strMessage
                Session.Message msiMessageTypeInfo, objMessage
End Function
 
Function MakePath(strPath)
                If Right(strPath, 1) = "\" Then
                               WriteToMsiLog "removing last backslash from path"
                               strPath = Left(strPath, Len(strPath)-1)
                End If
                MakePath = strPath
End Function

Leave a Reply

Your email address will not be published. Required fields are marked *