Executing an installation using script/Wise for Windows Installer 
Author Message
 Executing an installation using script/Wise for Windows Installer

I have written a script that installs a msi file stored in a property in my
WFWI application. I use WbemScripting.SWbemSink to run the installation.
The script is like this:
Option Explicit

Function InstallCOM
on error resume next

dim InstallSink
dim Locator
dim package_location
dim Service
dim InsCOM
dim Path
dim Method
dim Product
dim InParams

Set InstallSink = CreateObject("WbemScripting.SWbemSink")
if err then CheckError("1")
Set Locator = CreateObject("WbemScripting.SWbemLocator")
if err then CheckError("2")
package_location = Session.Property("MTS_INST")
if err then CheckError("3")

Set Service = Locator.ConnectServer("", "root\cimv2", "", "")
Service.Security_.ImpersonationLevel = 3

Set Product = Service.Get("Win32_Product")
Set Path = Product.Path_
Set Method = Product.Methods_.Item("Install")
Set InParams = Method.InParameters
Set InsCOM = InParams.SpawnInstance_

InsCOM.PackageLocation = package_location
InsCOM.AllUsers = "TRUE"
InsCOM.Options = ""

if err then CheckError("4")

Service.ExecMethodAsync InstallSink, Path, "Install", InsCOM, 128

if err then CheckError("5")

end function

Sub CheckError(s)
 Dim message
 If Err = 0 Then Exit Sub
 message = "Sted: " & s & "| " & Err.Source  & " :" & Hex(Err) & ": " &
 Fail message
End Sub

Sub Fail(message)
 msgbox "Error: " &  message,0,"Error occured"
End Sub

Is there another way to execute a installation. The reason for this is that
not all clients have installed the WMI which is needed to run this script !

Robert Vabo
Application developer
Gecko Informasjonssystemer AS

Sat, 03 May 2003 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Executing an installation using script/Wise for Windows Installer

2. Executing an installation using script/Wise for Windows Installer

3. WISE INSTALLER USERS: Learn how to properly create a WinCE installation


5. Windows Installer or Script based installer????

6. Wise Installation Scripts - ADO2.0/VB6

7. Wise Installation Scripts - ADO2.0/VB6

8. Visual Studio Installer -- Custom .exe file to be executed during installation

9. Urgent VB6 application installation problem (PDW or windows installer)

10. Installers: Wise or InstallShield?

11. Scripting another installer from within my installer

12. VB Active X Dll with wise installer


Powered by phpBB® Forum Software