Installing Novell ZCM Adaptive Agent in MDT 2012

The Novell ZCM Adaptive Agent is an example of an application that needs to be installed at deployment time and should not be included in the reference image.  In general, MDT Lite Touch handles installing applications at deployment time quite nicely.

The Adaptive agent, however is an example of an install process that does not play nice with MDT.  It really is a quite horrible installer.  First, lets take a look at the installer and what it does.

We know that to successfully install applications in MDT we need an unattended install that does not force a reboot (both of these are critical to success).  Our first step should be to look for command line switches to give us our silent install.  If we run PreAgentPkg_AgentCompleteDotNet.exe /? from a command line, we get the following information :

OK, it looks like we should be able to run “PreAgentPkg_AgentCompleteDotNet -q -x” to achieve our unattended install.  Lets go ahead and run this from a command prompt on our test system to see what happens.

The first thing we notice is that we get returned to the command prompt immediately.  Looking at the task manager, we can see that the exe is running.

After a time, though, the exe exits and we see some activity in the system tray :

Yes, thats right…  It kicks off a series of 52 individual packages!  Remember that it has already returned as if the process finished successfully.  This poses a problem in MDT.  MDT will start the next installation thinking that this one is finished.  Since we cannot have multiple msi isntallations running at the same time, one of them will fail.

What we need to do, then, is find a way to wrap this pesky installer in a script that can wait until it is finished.  Back to our test installation, we can see the last package to run is setup.exe :

Then when done, it just waits for a reboot

Armed with this knowledge, we can throw together a vbscript to launch the install with the proper switches and then wait for completion.

Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "PreAgentPkg_AgentCompleteDotNet.exe", "-q " & "-x"

strComputer = "." ' local computer
strProcess = "Setup.exe"

Do Until isProcessRunning(strComputer,strProcess)
  WScript.Sleep(5000)
Loop

Do While isProcessRunning(strComputer,strProcess)
  WScript.Sleep(5000)
Loop

WScript.Quit 0

' Function to check if a process is running
FUNCTION isProcessRunning(BYVAL strComputer,BYVAL strProcessName)

DIM objWMIService, strWMIQuery
strWMIQuery = "Select * from Win32_Process where name like '" & strProcessName & "'"

SET objWMIService = GETOBJECT("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" _
 & strComputer & "\root\cimv2")

IF objWMIService.ExecQuery(strWMIQuery).Count > 0 THEN
 isProcessRunning = TRUE
ELSE
 isProcessRunning = FALSE
END IF

END FUNCTION

The script makes use of a function to determine if a process is running.  In this case we want to see if setup.exe is running.  At the start, setup.exe is not running yet, and we use a loop to keep checking (and then sleeping) until it is running.  We then have a second loop that keeps checking until setup.exe is no longer running.  At this point we know the install is finished, and can exit the script.

This script is a bit crude, and lacks error checking but it does work.  To use it, place the script in the same directory as the Preagent installer.  When importing it as an application into MDT, set the Quiet install command to be : cscript install.vbs

12 thoughts on “Installing Novell ZCM Adaptive Agent in MDT 2012

  1. Vaughn, Thank you so much for posting this! I have been fighting with “Dirty Environment” errors in MDT caused by the quirky ZCM agent install interrupting task sequences for several weeks. Previously I was launching the ZCM install in one task sequence step and then launching sleep.exe in the next step in idle the task sequence for 5 minutes to allow ZCM installation to complete. Your script is a much better solution, can be implemented in one task sequence step, and has resolved the issues entirely. Much appreciated!

  2. Vaughn,
    i’m new to MDT and windows 7. Deploying novell client + zcm in a domain environment with MDT is proving to be challenging.

    Any chance your environment is similar? (client+agent+domain).. love to pick your brain about how you install thins and in what order

  3. Hi Joe, I have since moved on to another organization but I’ll share what I can recall..

    We were using ZCM, but not using the Novell client when deploying Windows 7. I had briefly started with the Novell Client when we first started looking at Windows 7, but we decided to do away with it in the Windows 7 deployments.

    The MDT deployment process relies on the system being able to auto login as the local administrator account after each reboot. Anything that “breaks” the auto login is going to stop MDT in its tracks. I have a suspicion that the Novell client would cause a problem in this regard?

    One thought is try to install the Novell client in such a way that it is not enabled (or otherwise blocking an auto login) and then have a script that enables it at the very end of the task sequence.

    • Thanks for quick response!
      Curious why you went away from the Novell Client.. ? I was told that using CIFS or something similar, instead of the novell client, doesn’t work very well.. haven’t tried myself though.

      Yes, you’re right, client causes problem with MDT. I tried installing the novell client as part of the reference image and when the computer boots up, it fails to login automatically as the local administrator.

      I’m also toying with the idea of installing the zenworks agent with MDT using your script, then installing the Novell Client with a zenworks bundle. (Takes so long to test these scenarios).

      In the XP days, I would install both client+agent in image (using switches to clean up zen stuff), then I’d autologin as an “install” user that would be associated bundles that would install automatically.. last bundle being used to “reset” autologin, and reboot the workstation. Struggling to do something similar with Win7.

      Any ideas appreciated 🙂 MDT sure is cool though. Were you using WIM for imaging or zenworks still?

  4. I would really suggest pulling the client out of the reference image and find a way to deploy it as part of the task sequence. The great thing about a tool like MDT is the ability to automate the whole process, including steps that need to happen after the WIM is laid down on the hard drive.

    I’m a big proponent of a modular approach to OS deployment, using a fairly “thin” image and layering settings and software onto that at deploy time. It can require a shift in your way of thinking and a little elbow grease to learn how to automate some tasks, but I feel it pays off in the long run.

    Good Luck!

    • In total agreement re: thin image.

      Anyway, I tried the zcm agent script.. MDT error’d out saying “error code: 1”.. not very helpful to me, and probably not to you either. Screenshot of log file: http://snag.gy/Vhyvt.jpg

      Any ideas?

      When windows deployed and error’d, I copied the script + package to the desktop and ran the script command, it installed fine. Does publisher need to be trusted first? does x64 matter?

  5. Nevermind.. I just noticed that MDT is NOT copying (or moving) the zenworks package or the script file into the \applications\novell zenworks agent\ folder for some reason.. weird.

  6. Hi Vaughn,

    How would I be able to edit the script to detect the architecture and run the x86 or x64 agent based on that.

    This is what I want to do:
    if architecture == x86 then run zenagentx86
    if architecture == AMD64 then run zenagentx64.

    Also where abouts would this go on the script?
    Thanks

Leave a Reply to vaughn Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.