ProvideComponent |
Once you have a script being invoked this is one way it could install the resources.
Example #1 - ProvideComponent() - Simplest way |
The following is something I have given a quick test, a script or process like it could be run during user logon:
set oInstaller = CreateObject("WindowsInstaller.Installer") ProductCode = "{7D7D60DC-ED0E-4497-BFDE-613A4170D72E}" FeatureId = "ALL.3.080.0101.TESTMSI" ComponentCode = "{3D6B3A43-C910-4BAE-B973-3A083E5F7E9F}" InstallMode = 0 'Original Source MSI must be available PcRc = oInstaller.ProvideComponent(ProductCode, FeatureId, ComponentCode, InstallMode) wscript.echo "RC:" & PcRc
Obviously you'd remove the hard codings! With the install mode "0", it ("ProvideComponent()" or "MsiProvideComponent()") will invoke repair (of the specified component only - I think) if the key registry value doesn't exist. Note that the source MSI must be available.
Example #2 - ProvideComponent() |
The following would appear to be a better approach and doesn't require the source MSI to be available:
const INSTALLMODE_NOSOURCERESOLUTION = -3 'Skip source resolution const INSTALLMODE_NODETECTION = -2 'Skip detection const INSTALLMODE_EXISTING = -1 'Provide, if available const INSTALLMODE_DEFAULT = 0 'Install, if absent const REINSTALLMODE_REPAIR = &H00000001 'Reserved bit - currently ignored const REINSTALLMODE_FILEMISSING = &H00000002 'Reinstall only if file is missing const REINSTALLMODE_FILEOLDERVERSION = &H00000004 'Reinstall if file is missing, or older version const REINSTALLMODE_FILEEQUALVERSION = &H00000008 'Reinstall if file is missing, or equal or older version const REINSTALLMODE_FILEEXACT = &H00000010 'Reinstall if file is missing, or not exact version const REINSTALLMODE_FILEVERIFY = &H00000020 'checksum executables, reinstall if missing or corrupt const REINSTALLMODE_FILEREPLACE = &H00000040 'Reinstall all files, regardless of version const REINSTALLMODE_MACHINEDATA = &H00000080 'insure required machine reg entries const REINSTALLMODE_USERDATA = &H00000100 'insure required user reg entries const REINSTALLMODE_SHORTCUT = &H00000200 'validate shortcuts items const REINSTALLMODE_PACKAGE = &H00000400 'use re-cache source install package const msiUILevelNone = 2 set oInstaller = CreateObject("WindowsInstaller.Installer") oInstaller.UILevel = msiUILevelNone 'If you don't wish to see the "normal" Windows Installer dialog ProductCode = "{7D7D60DC-ED0E-4497-BFDE-613A4170D72E}" FeatureId = "ALL.3.080.0101.TESTMSI" ComponentCode = "{3D6B3A43-C910-4BAE-B973-3A083E5F7E9F}" on error resume next PcRc = oInstaller.ProvideComponent(ProductCode, FeatureId, ComponentCode, INSTALLMODE_EXISTING) 'Query if keypath exists if err.number = 0 then wscript.echo "QUERY: KeyPath Exists: " & PcRc else '--- Keypath does exist so for this component fix up the user registry --- wscript.echo "QUERY: KeyPath doesn't exist, need to install component" PcRc = oInstaller.ProvideComponent(ProductCode, FeatureId, ComponentCode, REINSTALLMODE_USERDATA) wscript.echo "Install RC:" & PcRc end if