Novell Home

Scripted ZENworks Imaging

Novell Cool Solutions: Trench
By Matthew Warden Whited

Digg This - Slashdot This

Posted: 10 Mar 2005
 

Here is a Workstation Imaging script that I use everyday. This script will request a new name if one is not found in ZIS, prompt you if you want to change the existing name, as well as prompt you for a building, room, and model of the system you would like to image.

Just copy this script into a Workstation Image object and tweak to fit your needs.

#======== Start of Script ========
# Created by: Matthew Whited (matt@whitedonline.com)
# Based on  "Making a Scripted Image ..." By Jesse David Hollington

ZISNAME=`zisview Name`
IMGSVR=10.130.135.6


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; 
	done; 

	if test $WSNAME; then
		zisedit -c
		zisedit Name=$WSNAME;
	fi
else
	WSNAME=
	echo ""
	echo "Computer Name: $ZISNAME"
	echo ""

	echo -n "Change Name (Enter Name to change leave blank to skip): " 
	read $WSNAME
	
	if test $WSNAME; then
		echo "Name Changed to $WSNAME"
		zisedit -c
		zisedit Name=$WSNAME;
	fi	
fi 

echo ""
echo "Building List"
echo "----------------------"
echo "aml		Amalgamated Place"
echo "ecc		Eastland Career Center"
echo "fcc		Fairfield CareerCenter"
echo "<anything else>	Skip Building Set"
echo ""
echo -n "Enter Building: "
read WSBLDG;

if [ "$WSBLDG" = "ecc" ]; then
	IMGSVR=10.130.135.6

	echo ""
	echo "Room List"
	echo "----------------------"
	echo "2002		MO"
	echo "2003		AS"
	echo "2004		IM"
	echo "2005		IS"
	echo "2006		BF"
	echo "1113		DD"
	echo "<anything else>	Base"
	echo ""
	echo -n "Enter Room: "
	read WSROOM;

elif [ "$WSBLDG" = "fcc" ]; then
	IMGSVR=10.130.139.6

	echo ""
	echo "Room List"
	echo "----------------------"
	echo "1360		LO"
#	echo "1630		CS"
	echo "<anything else>	Base"
	echo ""
	echo -n "Enter Room: "
	read WSROOM;

elif [ "$WSBLDG" = "aml" ]; then
	IMGSVR=10.130.131.1
	echo "No Room List"

fi

echo ""
echo "Computer Model"
echo "----------------------"
echo "gx260		Dell Optiplex GX260"
echo "gx270		Dell Optiplex GX270"
echo "gx280		Dell Optiplex GX280"
echo "gwsolo		Gateway Solo 1450"
echo "thpdg40		IBM Thinkpad G40"
echo "<anything else>	Skip Driver Set"
echo ""
echo -n "Enter Model: "
read WSMODL;


echo "Loading Base Image"
img rp $IMGSVR //$IMGSVR/pxe/sysprepd

if [ "$WSMODL" != "" ]; then
	echo "Loading Driver Set"
	img rp $IMGSVR //$IMGSVR/pxe/drv_$WSMODL
	if [ "$?" = "59" ]; then
		echo "Warning Bad Driver Set"
	fi
fi

if [ "$WSBLDG" != "" ]; then
	echo "Loading Building Set"
	img rp $IMGSVR //$IMGSVR/pxe/bldg_$WSBLDG
	if [ "$?" = "59" ]; then
		echo "Warning Building Set"
	fi
fi

if [ "$WSROOM" != "" ]; then
	echo "Loading Room Set"

	if [ "$WSBLDG" = "ecc" ]; then
		echo "Eastland CC Room $WSROOM"
		
		if [ "$WSROOM" = "2002" ]; then
			img rp $IMGSVR //$IMGSVR/pxe/
app_Thomson_Course_Technology_SAM_2003.zmg
	
		elif [ "$WSROOM" = "2003" ]; then
			img rp $IMGSVR //$IMGSVR/pxe/
app_Thomson_Course_Technology_SAM_2003.zmg
			img rp $IMGSVR //$IMGSVR/pxe/
app_Intuit_Quickbooks_Pro_2003.zmg
	
		elif [ "$WSROOM" = "2004" ]; then
			img rp $IMGSVR //$IMGSVR/pxe/
app_Thomson_Course_Technology_SAM_2003.zmg
			img rp $IMGSVR //$IMGSVR/pxe/
app_Adobe_Photoshop_7.0.zmg
			img rp $IMGSVR //$IMGSVR/pxe/
app_Macromedia_Studio_MX_2004.zmg
			echo "Add Adobe Premiere Set Here"
	
		elif [ "$WSROOM" = "2005" ]; then
			img rp $IMGSVR //$IMGSVR/pxe/
app_Thomson_Course_Technology_SAM_2003.zmg
			img rp $IMGSVR //$IMGSVR/pxe/
app_Microsoft_Visual_Studio_6.zmg
	
		elif [ "$WSROOM" = "2006" ]; then
			img rp $IMGSVR //$IMGSVR/pxe/
app_Thomson_Course_Technology_SAM_2003.zmg
			img rp $IMGSVR //$IMGSVR/pxe/
app_Intuit_Quickbooks_Pro_2003.zmg
	
		elif [ "$WSROOM" = "1113" ]; then
			img rp $IMGSVR //$IMGSVR/pxe/
app_Autodesk_AutoCAD_2002.zmg
			echo "Add Autodesk Design Academy set here"
	
		else
			echo "No Room based Images"
		fi
			
	
	elif [ "$WSBLDG" = "fcc" ]; then
		echo "Fairfield CC Room $WSROOM"
	
		if [ "$WSROOM" = "1360" ]; then
			img rp $IMGSVR //$IMGSVR/pxe/
app_Thomson_Course_Technology_SAM_2003.zmg

		else
			echo "No Room based Images"
		fi"
	
	elif [ "$WSBLDG" = "aml" ]; then
		echo "Amlagamated Room $WSROOM"
			echo "No Room based Images"
	
	fi
fi

reboot

#======== End of Script =========

NOTE: If you try to use this script and it is gives you problems trying to rename a workstation, you need to change the line "read $WSNAME" to "read WSNAME"

If you have any questions you may contact Matthew at matt@whitedonline.com


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

© 2014 Novell