Remove OS Version Check

By | May 10, 2006

Occasionally developers of software will write software for specific versions  of  Windows Operating Systems and make it so it will not install on those versions. One common way of doing this is to run a check via an msi installer. This script will allow you to remove the OS check from the msi file.

 Copy and paste the following code into notepad and save it as RemoveOScheck.vbs

———-COPY EVERYTHING BELOW THIS LINE———-

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

‘ Process SQL statements and delete the crap out of this installer!
Dim query, view, record, message, rowData, columnCount, delim, column
Set view = database.OpenView("Delete from LaunchCondition") : CheckError
view.Execute
wscript.echo "Launch Conditions Removed"
Set view = database.OpenView("Delete from InstallExecuteSequence where Action=’OnCheckSilentInstall’")
view.Execute
wscript.echo "OnCheckSilentInstall step removed"
Set view = database.OpenView("Delete from Property where Property = ‘ISSETUPDRIVEN’")
view.Execute
wscript.echo "Property ISSETUPDRIVEN removed"
Set view = database.OpenView("INSERT INTO Property (Property,Value) VALUES (‘ISSETUPDRIVEN’,1)")
view.Execute
wscript.echo "Property ISSETUPDRIVEN added"
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

———-COPY EVERYTHING ABOVE THIS LINE———-

To use this, simply drag the msi file running the version check overtop RemoveOScheck.vbs and it will simply open up the msi file, remove the check and save it.

Please remember to make a backup of the msi BEFORE running the script.

THIS INFORMATION IS PROVIDED "AS IS" WITH NO WARRANTIES EXPRESSED OR IMPLIED.

Leave a Reply

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