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. how using in installshield windows installer

4. Scripting for Windows Installer problem

5. Windows Installer ans scripting facilities (?)

6. Error loading advpack.dll on installation of Windows Script 5.5

7. Windows Script Host to Execute Remote Script Q311269

8. Installation of German Windows Scripting 5.6 fails - why?

9. JScript from an msi, Windows Installer package

10. Error-codes from Windows Installer ?!?!?!

11. Windows Installer--VBScript Custom Action

12. ANNOUNCE: izfree Tools for Windows Installer (HTA example)


Powered by phpBB® Forum Software