ZCM 11 imaging megapost – part 4 (ZCM Agent)

windows 7 novell blog bannerI was going to include this in the previous post but it was getting a bit lengthy so decided to split into a separate one. I prefer to keep the ZCM Agent off the base image for a couple of reasons…

a) avoids having to update the base image when a new version comes out
b) avoids any possibility of mistakes \ human error around clearing machine IDs etc

The commands to install the agent are quite simple but there’s a few extra tasks we need to do to make the process slick and painless (after all that’s the reason we’re scripting everything 😉 )

Disable Passive Login Mode Prompt

By default after the ZCM Agent is installed it will try to capture user authentication during login, this is fine and dandy if you’re logging in with a Novell \ Active Directory account but not so great if you’re running additional scripts during autoadminlogon.

As the autologon is basically a local admin account ZCM can’t find a user source and pops up a box asking for you to login, at which point your nice unattended install will stop… not good!

Fortunately you can disable this by setting a registry key…

Ref: http://www.novell.com/documentation/zenworks11/zen11_system_admin/?page=/documentation/zenworks11/zen11_system_admin/data/bbtsocd.html

Use this piece of script before the ZCM Agent installation (I put it beforehand as the Agent installer auto reboots after completion)

Md "HKLM:\SOFTWARE\Novell\ZCM\ZenLgn\"
New-ItemProperty "HKLM:\SOFTWARE\Novell\ZCM\ZenLgn\" -Name "DisablePassiveModeLoginPrompt" -Value 1 -PropertyType "DWord" -Force

Splash screen

The ZCM Agent differs from the Novell Client in that the installer runs more quietly and pops up balloon notifications in the system tray as it goes along. This is great for many situations but not so much so for our imaging process as it has the unfortunate side effect of showing the Windows desktop while the installer runs.

A user glancing at the machine could easily think imaging has finished and shut it down etc so I looked for a way to put a splash screen up in a similar way to the Novell client installer. There’s nothing out the box so I turned to my trusty HTA methods.

What I’ve ended up with is a full-screen HTA that runs before the ZCM Agent installer that can’t be closed by the user. You can still see the taskbar and as such the notifications of the Agent progress although the Start button still shows. If you’re really paranoid you could run a small AutoIT (or similar) file to lock the keyboard and mouse but I think in reality the HTA will do the trick.

While making the HTA I found a neat way of embedding images into them, use the base64 generator here http://webcodertools.com/imagetobase64converter

A generic version of the HTA I used is available on SkyDrive, open it up in Notepad to see how it avoids Alt+F4 and to add any additional text \ images

The Powershell code for the HTA and Agent installation is below, note my additional variable $RegistrationKey which I’ve used to dynamically generate keys for our workstations. If you don’t need it just remove it (and the -k switch) from AgentParams section.

As always note the path to the Agent installation folder and ensure it matches whatever you’re using in your add-on image

$HTACommand = "C:\Windows\System32\mshta.exe"
$HTAParams = "C:\SETUP\ZCM_splash.hta"
$process = [Diagnostics.Process]::Start($HTACommand,$HTAParams)
# install ZCM Agent with registration key based on workgroup name
$AgentCommand = "C:\SETUP\ZCM_Agent\PreAgentPkg_AgentCompleteDotNet.exe"
$AgentParams = "-q -k",$RegistrationKey
$process = [Diagnostics.Process]::Start($AgentCommand,$AgentParams)

I’ve used Registration Keys to get machines placed into groups for software installation later on as Dynamic Groups won’t update in real-time as the imaging process is proceeding.


2 Responses to ZCM 11 imaging megapost – part 4 (ZCM Agent)

  1. Gershwin says:

    Hi GShaw,

    I am running out of ideas here and thought seeing as you have experience with this, maybe you could assist.

    Let me paint the picture quick.
    I am trying to image machines in a University environment with lots of computer lab machines.
    Now I have built my Windows 7 image and all seems to be running well with the image itself except for 1 small problem which I just cant seem to figure out.
    Every once in a while some machines, when re-imaged will simply not register with the zenworks server. These machines remain unmanaged when I log in to them locally. I am using the same approach as you do by installing both the zcm11.2.4 agent and the Novell client in post imaging scripts.

    The zenworks agent install happens in the first stage/script then the agent installation reboots the machine when it is done. I have placed the full agent onto the image partition itself and the script calls the installation from there. Then the Novell Client installs after reboot in the second script.

    This is confusing me because a few days ago I reimaged the same group of lab machines (lets call it Lab A) with the same image and the machines registered correctly. Then I made a slight change to the image, slight change as in cosmetic that has nothing to do with the scripts or agent. I then reimaged this group of machines and they failed to register with the zenworks server. When re-imaging this group, I reimaged manually as in from the PXE boot menu – imaging maintenance mode, type img at the zenworks prompt, and manually typed out the image name. What I did do prior to imaging was go into the zenworks admin web console and I specifically unregistered those machines from zenworks devices workstations.

    On the other hand, I did the same process of reimaging another group of lab machines (lets call it Lab B) with the same image and this time I assigned an imaging bundle to the machines via the zenworks console. These machines all registered 100% as they should have.

    The second option of imaging machines from the web console will not work all the time as sometimes we will get new machines that have never registered with the zenworks server before.

    Any ideas as to why the other failed to register the second time around?


    • gshaw0 says:

      This sounds very similar to an issue we had when developing our scripts, random machines would fail to register (which then leads to auto Bundle installation failing later on etc).

      Turned out our DHCP server was sometimes not responding quickly enough and the script was running with no network access, hence the registration failure. There seemed to be no hard and fast rule for when a machine would work \ fail, one of those “when the wind is facing east and the sun is high in the sky” type problems!

      After a bit of searching I found a neat “wait for network” script that I’ve added before any installations that need network connectivity (mainly ZCM Agent and Bundles), I’ll put it in a code box here and on SkyDrive in case the formatting goes wonky:

      # Wait for a DHCP-enabled interface to develop
      # a default gateway.
      # usage: wait-for-network [ ]

      $tries = 30

      function wait-for-network ($tries) {
      while (1) {
      # Get a list of DHCP-enabled interfaces that have a
      # non-$null DefaultIPGateway property.
      $x = gwmi -class Win32_NetworkAdapterConfiguration `
      -filter DHCPEnabled=TRUE |
      where { $_.DefaultIPGateway -ne $null }

      # If there is (at least) one available, exit the loop.
      if ( ($x | measure).count -gt 0 ) {

      # If $tries > 0 and we have tried $tries times without
      # success, throw an exception.
      if ( $tries -gt 0 -and $try++ -ge $tries ) {
      throw "Network unavaiable after $try tries."

      # Wait one second.
      start-sleep -s 1

      If it fails the dialog box will stay open so you can visually spot any really ropey machines (if it can’t get a DHCP lease after 30 seconds you’ve got problems elsewhere)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: