Novell Home

Scripted Installs that use a Wrapper

Novell Cool Solutions: Trench
By David Leaf

Digg This - Slashdot This

Posted: 27 Feb 2003
 

Ever have a silent scripted install that uses a wrapper? I tried to use the "Monitor Module" option to get the app to wait until the install finishes but I could never get it to work. So, here's what I did instead.

I wrote a piece of VBScript that works in 2000 and above (might in 98 and NT, I never tested it though). Just put the code in one of the four available script positions (as necessary for your situation), set the script engine to "wscript", the extension to ".vbs" and change the script for your appropriate file and you're set.

As written, it is designed to launch the install, wait for the wrapper to exit, monitor processes until a specific one starts, then monitor processes until that one specific one stops.

It has helped me immensely, and I hope it helps someone else out there. I use it with my client access install as a pre-launch script, then I have some custom settings (keymappings, behaviour defaults, etc...) which distribute after the silent install in the standard ZEN format. (Actually, I used snAppShot to capture them.)

Here's the script:

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _        
    ExecNotificationQuery("select * from __instancecreationevent " _ 
        & " within 1 where TargetInstance isa 'Win32_Process'")
Set dolMonitoredProcesses = objWMIService. _        
    ExecNotificationQuery("select * from __instancedeletionevent " _ 
        & " within 1 where TargetInstance isa 'Win32_Process'")

Set oExec = WshShell.Exec("x:\apps\cav5r1\setup  
-s -f1x:\apps\cav5r1\pc5250.iss -f2c:\ca-inst.log")

Do While oExec.Status = 0
     WScript.Sleep 100
Loop

i = 0
Do While i = 0
    Set objLatestProcess = colMonitoredProcesses.NextEvent
    If objLatestProcess.TargetInstance.Name = "_ISDEL.EXE" Then
	i = 1
    End If
Loop

i = 0
Do While i = 0
    Set objLatestProcess = dolMonitoredProcesses.NextEvent
    If objLatestProcess.TargetInstance.Name = "_ISDEL.EXE" Then
	i = 1
    End If
Loop

If you have any questions you may contact David at dleaf@myrealbox.com


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell