Novell is now a part of Micro Focus

Making a Scripted Image Utilizing ZISVIEW and ZISEDIT

Novell Cool Solutions: Trench
By Jesse David Hollington

Digg This - Slashdot This

Posted: 2 Apr 2003

Editor's Note: Check out the Other Suggestion that has come in about this article.

ZENworks Imaging is a great feature for rolling out new workstations with Server-based Workstation imaging policies and PXE support.

One of the limitations in ZENworks for Desktops Imaging is that it still does not provide enough control over the naming of workstations when deploying images to new workstations (ie, those without Image-Safe data).

In working on one particular ZENworks for Desktops implementation, this became very apparent, as this particular client wanted to manually name workstations, but was relying on manually logging in and renaming the workstation following the completion of the imaging session. This caused additional work, as somebody had to manipulate the workstation AFTER the imaging session was complete.

Ideally, a solution was required to be able to drop a new workstation off at an end-user's desk, start the imaging process, and walk away.

SOLUTION: The solution in this case was a scripted image that takes advantage of the new Linux-based ZISVIEW and ZISEDIT tools. These tools are found within the Linux imaging partition in ZfD4 and SP1 for ZfD 3.2. However, there are some limitations on using these on ZfD 3.2 (more on that later).

In its basic form, ZISVIEW is a utility that allows the image-safe data area (ISD) to be viewed on the screen (similar to the "IMG INFO Z" command, but with much more detail). Through the use of command-line parameters, ZISVIEW can be used to read entries from the image-safe data into Linux environment variables.

ZISEDIT does the reverse. Invoked directly, it will bring up a screen allowing the operator to manually edit the content of the image-safe data area. Like ZISVIEW, however, it will take command-line parameters which can be used to modify the content of the image-safe data.

Normally, after an imaging session completes, ZISWIN runs in "restore" mode to rename the workstation in accordance with the name (or naming standard) stored in the image-safe data. By using ZISEDIT to put our own name into the image-safe data, we can control the name that ZISWIN will use when it renames the workstation.

Further, since the imaging operations operate under Linux, a "scripted image" is actually just a Linux shell script (similar to a batch file for those DOS/Windows folks out there).

So, armed with these two utilities, and a very basic knowledge of Linux shell scripting, it is possible to create a script to prompt the imaging operator to enter a workstation name at the beginning of the imaging process.

    while test ! $WSNAME; do
echo -n "Enter the workstation name: "
read WSNAME;

This would prompt the user to enter a workstation name, and store it in an environment variable called WSNAME. Once the image has been laid down, we would then enter a line such as the following:

zisedit Name=$WSNAME

This uses the ZISEDIT utility to set the workstation name (in the ISD) to the value of the WSNAME variable (entered above).

It is important that this be done AFTER the image has been laid down, as the IMG command itself may modify the ISD, depending upon the configuration of the imaging policies.

One other consideration, however, is that we do NOT want to prompt for a workstation name if the machine already HAS a name (ie, the machine is being re-imaged, and we want it to retain the same name that is already in the image-safe data). A little fancier scripting is required to test for this, but is easily accomplished with the following set of commands at the beginning of the script:

  ZISNAME=`zisview Name`

  if test ! $ZISNAME; then
     echo -e "No image-safe data found."
     echo -e "Assumed to be a new workstation.\n"

	while test ! $WSNAME; do
           echo -n "Enter the workstation name: "
	   read WSNAME;

This will use ZISVIEW to read the existing workstation name from the ISD into a variable called ZISNAME. If the ISD does not contain a name for the workstation, the ZISNAME variable will be empty, in which case the content of the IF statement is run, prompting the user to enter a new workstation name.

Since we don't want to rename the workstation in this case, we also need to add a bit of extra stuff at the end of the script:

  if test $WSNAME; then
  	zisedit Name=$WSNAME;

This section complements the section at the beginning. If the user has not entered a name (into WSNAME) because the workstation already had one, then the section which causes ZISEDIT to run is bypassed and the workstation is left with whatever name it already had before the imaging process ran.

In the end, you have a scripted image that might look something like the example.

Note that ZISEDIT can also be used to clear or remote the image-safe data area completely. This is similar to what the various ZISCLEAR utilities do, but has the advantage of being able to do it from within the Linux imaging partition (rather than having to reboot back to DOS). ZISEDIT -R will REMOVE the image-safe data area completely from the drive, while ZISEDIT -C will clear the contents of the image-safe data area (while leaving the structure intact). For practical purposes, I cannot see the difference of one over the other, and I frequently just use the -R option if I want to do a "fresh" re-image of a system.

The major caveat ZfD 3.2 (mentioned earlier) is that although the ZISEDIT/ZISVIEW tools are included in ZfD 3.2 SP1, they are still the ZfD 4 versions. When running ZISVIEW, you will see that a version number is reported for the image-safe data. This will be a "3" for ZfD 3 (makes sense) or a "5" for ZfD 4 (go figure). The problem here is that ZISEDIT will write a version "5" image-safe data area. However, the ZfD 3 tools such as IMG and ZISWIN do not know how to read a version 5 image-safe data area. In fact, these utilities will actually erase the content of the image-safe data and reset it back to version 3. As a result, these scripts will NOT work with ZfD 3.2 SP1, unless Novell provides a ZISEDIT tool that works with a version 3 image-safe data area.

Note, however, that ZISVIEW will allow a version 3 ISD to be viewed. ZISEDIT (with the "-r" parameter) can also be used to clear the image-safe data area. However, in a ZfD3.2 environment, this is about the only use that these two utilities have.

EXAMPLE: ZISNAME=`zisview Name`

if test ! $ZISNAME; then
	echo -e "No image-safe data found.  
	Assumed to be a new workstation.\n"

	while test ! $WSNAME; do
	echo -n "Please enter the workstation name: "
	read WSNAME;


img rp $PROXYADDR //zenworks/zen/images/netvista2k.zmg
img rp $PROXYADDR //zenworks/zen/images/addon/zfd4.zmg

if test $WSNAME; then
	zisedit Name=$WSNAME;

If you have any questions you may contact Jesse at

Other Suggestions

Richard Gray

This is a refinement of the solution posted by Jesse David Hollington. For some reason the script he presented didn't work in my linux partition. especially setting the variable to the result from 'zisview name' needed to be TESTPART=$(zdisk -detect) before it would work.

SOLUTION: I re-wrote the script so it will autorun from the boot CD. Because of this the script now asks to confirm that you wish to perform the operation.

The script detects and installs the linux partition if not there. (This is not an elegant way of doing it but it works.)

The whole process only requires three manual steps, or two if the computer already has a name.

To autorun the script use

export IMGCMD="/bin/newpc.s"

at the end of your settings.txt file

add set.txt to /addfiles/bin on the cd rom.

This script is made so that it will perform all the tasks for making a new workstation from scratch. It will detect the ZEN partition, and if it's not there will add it. If the Image Safe Data contains a computer name it will keep that name. If the ISD does not have a name (new computer) it will prompt for one.

Thus armed with a CD only three steps are required to build a fully functioning workstation from scratch.

  1. Agree the process
  2. Give the Computer a valid name
  3. Reboot

Note: I am not a UNIX\Linux hack. This is my first attempt at the scriping process. If you can find better ways to improve this please feel free.

In order to make the CD, use the ISO file under the imaging section of the ZEN server, remembering to close the session but leave the CD open.

Make a directory \addfiles\bin\ and add this script and set.txt to it. (set.txt is a settings text file without the line :-)

Export IMGCMD="/bin/newpc.s" (or whatever you decide to call the script)

This will copy the files from addfiles to the bin directory and automaticaly run this script.

This is the text returned from zdisk -detect when there is no partition. It's easier to test the full text.

NOPART=" !Zen partition not found on device /dev/hda.
 !No disabled ZEN partition detected.
 !No enabled ZEN partition detected.
export ENABLEZEN=0"

Make sure you REALLY want to do this.

echo  "                WARNING!! 
	This CD will remove ALL DATA from the drive"
echo -n "            Continue Y/N (must be Y not y to continue) "
read AGREE
if [ "$AGREE" = "Y" ] ; then

Test to see if the ZEN partition exists.

TESTPART=$(zdisk -detect)
	if [ "$TESTPART" = "$NOPART" ] ;then

Test to see if the value returned from ZISVIEW Name is NULL. If it's not, then set WSNAME to the name. If it is NULL ask for a name to be entered.

if [ -n "$(zisview Name)" ]; then
		WSNAME=$(zisview name)
		echo /e "No image safe data found
		Assumed to be a new workstation"
		while test ! $WSNAME; do
			echo -n "Please enter the workstation name : "
			read WSNAME

Add the image file. The PROXYADDR variable contains my server name. Can be changed to explicit values.

img rp $PROXYADDR //$PROXYADDR/vol1/apps/images/w2kfull.zmg

Set the name in the ZEN Partition to what it was before or what we wanted to call it.

zisedit Name=$WSNAME

Copy a settings.txt file that will not automatically call this script.

mount -t ext2 $ZENDEVICE /mnt/harddisk
	cp -f /bin/set.txt /mnt/harddisk/bin/settings.txt

Enable the ZEN partition for next boot.

img zenp enable


Richard is the Network Manager at Oceaneering AS in Norway. If you have any questions you may contact Richard at

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

© Copyright Micro Focus or one of its affiliates