I am trying to set up an universal imaging script that will detect hardware and pull down proper driver add-on image. My script is working other than the fact that every time the machine reboots, instead of going through the sysprep process, it just starts re-imaging again. I am assigning the imaging script through zcc. I'm unfamiliar with the imaging process where after an image is applied via a script, that it would let the zenworks server know that the image has been applied and there is no more imaging work for that device.

Here is my script:

zoneguid=`zisview -z ZoneGUID`
deviceguid=`zisview -z DeviceGuid`
deviceid=`zisview -z DeviceID`
machinename=`zisview -z computername`
workgroup=`zisview -z windowsworkgroup`
hostname=`zisview z DNSHostName`

hwinfo --bios | grep -i 'Product' > /tmp/model.txt
cat /tmp/model.txt
model=`cat /tmp/model.txt | sed -e "s/\"/=/g"`
echo $model

fdisk /dev/sda << !cmds!

img pd-all
img pc1 ntfs
img pa1
zisedit -r
zisedit -c
zisedit ComputerName=$machinename
zisedit WindowsWorkgroup=$workgroup
zisedit WorkstationID=$deviceid
zisedit DeviceGUID=$deviceguid
zisedit T=$zoneguid
zisedit DNSHostName=$hostname
zisedit JustImaged=True



img rp $imgserv //$imgserv/$imgpath/win7sysprep.zmg

case $model in
echo 'OptiPlex 620';
img rp $imgserv //$imgserv/$imgpath/models/gx620.zmg
img rp $imgserv //$imgserv/$imgpath/apps/baseapps.zmg
echo 'Lenovo R400';
img rp $imgserv //$imgserv/$imgpath/models/r400.zmg
img rp $imgserv //$imgserv/$imgpath/apps/baseapps.zmg
echo 'Optiplex 780';
img rp $imgserv //$imgserv/$imgpath/apps/baseapps.zmg
echo 'Not found';

reboot -f

Any help would be appreciated!