How to silently install ZenWorks 10 with vbScript without having to watch the screen during installation

So You want to install ZenWorks 10.x.x.x silently on a machine, sounds easy enough right?

Well ZenWorks is making it slightly harder, if You just run the installer with a stay quiet parameter, when it finishes and You or the installer reboots, it was not actually finished. After the installation ZenWorks sits and runs msi packets that needs to install as well, so even thou the installer exited and says all done, another thread from ZenWorks is still working.

I used the following script to install ZenWorks 10 without showing it to the user, and then monitor the little thread doing the other installs, when that was finished I continue to do whatever it is I want to do, in my case tell the user I am rebooting their machine and reboot, but thats entirely up to You.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Popup "Installing ZenWorks, please wait", 60, "Please Wait..", 64
WshShell.Run "X:\myfolder\Novell\Zenworks\10.2.2\PreAgentPkg_AgentComplete.exe -x -q", 0, True
WScript.Sleep 120000 ' 120 seconds
While CheckProcess("ZENPreAgent.exe") = True
  ' Installation still running, waiting x seconds
  WScript.Sleep 5000
 Wend
 WshShell.Popup "Installation completed - machine should be restarted.", 60, "Please restart computer", 64

Function CheckProcess(ByVal strName)
' Monitor Threads
CheckProcess = False
Set objDictionary = CreateObject("Scripting.Dictionary")

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process")

For each objProcess in colProcesses
    objDictionary.Add objProcess.ProcessID, objProcess.Name
Next

Set colThreads = objWMIService.ExecQuery _
    ("Select * from Win32_Thread")
For each objThread in colThreads
    intProcessID = Int(objThread.ProcessHandle)
    strProcessName = objDictionary.Item(intProcessID)
    If UCase(strProcessName) = UCase(strName) Then
    	CheckProcess = True
    End If
Next
End Function

2 Responses to “How to silently install ZenWorks 10 with vbScript without having to watch the screen during installation”

  • Mohit:

    Hi..

    This code is not running my application in silent mode.

    Rest of all is working fine. but Silent installation is not working..

    Please Help me..

    Thank You,

    Regards,

  • Sole:

    Hi Mohit,

    Do you have any more information ? What are you doing, what is happening?
    If you do not have more details there is no way for me to know what your problem is.

    -Sole

Leave a Reply