SHOW:
|
|
- or go back to the newest paste.
1 | ' name this file as RemoveOSCHeck.vbs | |
2 | ' This script can be used to remove operating system version checks (2000, xp, vista, 7) | |
3 | ' or architecture checks used for (32-bit x86 or 64-bit x64 systems) | |
4 | ' that are part of an MSI installer. To use drag an MSI file to RemoveOSCHeck.vbs icon. | |
5 | Option Explicit | |
6 | ||
7 | Const msiOpenDatabaseModeReadOnly = 0 | |
8 | Const msiOpenDatabaseModeTransact = 1 | |
9 | ||
10 | Dim argNum, argCount:argCount = Wscript.Arguments.Count | |
11 | If (argCount < 1) Then | |
12 | Wscript.Echo "Please supply the name of the msi file to be modified." | |
13 | Wscript.Quit 1 | |
14 | End If | |
15 | ||
16 | ' Scan arguments for valid SQL keyword and to determine if any update operations | |
17 | Dim openMode : openMode = msiOpenDatabaseModeReadOnly | |
18 | openMode = msiOpenDatabaseModeTransact | |
19 | ||
20 | ' Connect to Windows installer object | |
21 | Dim installer : Set installer = Nothing | |
22 | Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError | |
23 | ||
24 | ' Open database | |
25 | Dim databasePath:databasePath = Wscript.Arguments(0) | |
26 | Dim database : Set database = installer.OpenDatabase(databasePath, openMode) : CheckError | |
27 | ||
28 | ' Process SQL statements and delete the crap out of this installer! | |
29 | Dim query, view, record, message, rowData, columnCount, delim, column | |
30 | Set view = database.OpenView("Delete from LaunchCondition") : CheckError | |
31 | view.Execute | |
32 | wscript.echo "Launch Conditions Removed" | |
33 | Set view = database.OpenView("Delete from InstallExecuteSequence where Action='OnCheckSilentInstall'") | |
34 | view.Execute | |
35 | wscript.echo "OnCheckSilentInstall step removed" | |
36 | Set view = database.OpenView("Delete from Property where Property = 'ISSETUPDRIVEN'") | |
37 | view.Execute | |
38 | wscript.echo "Property ISSETUPDRIVEN removed" | |
39 | Set view = database.OpenView("INSERT INTO Property (Property,Value) VALUES ('ISSETUPDRIVEN',1)") | |
40 | view.Execute | |
41 | wscript.echo "Property ISSETUPDRIVEN added" | |
42 | database.Commit | |
43 | Wscript.Quit 0 | |
44 | ||
45 | Sub CheckError | |
46 | Dim message, errRec | |
47 | If Err = 0 Then Exit Sub | |
48 | message = Err.Source & " " & Hex(Err) & ": " & Err.Description | |
49 | If Not installer Is Nothing Then | |
50 | Set errRec = installer.LastErrorRecord | |
51 | If Not errRec Is Nothing Then message = message & vbLf & errRec.FormatText | |
52 | End If | |
53 | Fail message | |
54 | End Sub | |
55 | ||
56 | Sub Fail(message) | |
57 | Wscript.Echo message | |
58 | Wscript.Quit 2 | |
59 | End Sub |