Home > Uncategorized > Quick script: Remove OS check from MSI installer

Quick script: Remove OS check from MSI installer

I came across the eEye Retina CS installer which verifies if you are on a server OS, and took a look at it in ORCA. After searching for a solution, I came across a VBS. I’ve minimized this VBS to just remove a few checks.

Option Explicit

Const msiOpenDatabaseModeReadOnly = 0
Const msiOpenDatabaseModeTransact = 1

Dim argNum, argCount:argCount = Wscript.Arguments.Count
If (argCount < 1) Then
Wscript.Echo "Please supply the name of the msi file to be modified."
Wscript.Quit 1
End If

' Scan arguments for valid SQL keyword and to determine if any update operations
Dim openMode : openMode = msiOpenDatabaseModeReadOnly
openMode = msiOpenDatabaseModeTransact

' Connect to Windows installer object
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError

' Open database
Dim databasePath:databasePath = Wscript.Arguments(0)
Dim database : Set database = installer.OpenDatabase(databasePath, openMode) : CheckError

Dim query, view, record, message, rowData, columnCount, delim, column
Set view = database.OpenView("Delete from LaunchCondition where Description='[ProductName] requires Windows 2003 with Service Pack 2 or higher. 64-bit operating systems are only supported on Windows 2008 and higher.'") : CheckError
'Set view = database.OpenView("Delete from LaunchCondition") : CheckError 'uncomment to delete the entire key
view.Execute
Set view = database.OpenView("Delete from LaunchCondition where Description='[ProductName] requires a server operating system such as Windows 2008.'") : CheckError
view.Execute
wscript.echo "Removed OS check only"
database.Commit
Wscript.Quit 0

Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbLf & errRec.FormatText
End If
Fail message
End Sub

Sub Fail(message)
Wscript.Echo message
Wscript.Quit 2
End Sub
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: