Course Locator

Leveraging Scripted Imaging in ZENworks Configuration Management [Course 9316]

Course Overview

This hands-on class teaches bash scripting techniques and imaging commands that can be used when leveraging the scripted imaging capabilities of ZENworks 11.2 Configuration Management and above. Scripted imaging allows users to accomplish complicated imaging processing not available using standard Image Bundles. Topics will include:

The hands-on portion of the class includes eight labs demonstrating the various bash scripting capabilities and constructs listed above. Followed by two extensive "challenge" labs where the student will combine the above bash scripting techniques with ZCM imaging to accomplish imaging tasks that can not be addressed by using Preboot Bundles alone.

  • Interacting with the user in your script
  • Creating, reading, and writing text files on your Image Server
  • Using hwinfo to obtain hardware information about a workstation
  • Manipulating strings using cut, awk, and sed
  • Piping and redirection
  • Using the tail and head commands
  • Declaring and using variables
  • Conditional Processing using if and case statements
  • Looping Contructs
  • Array processing
  • Using functions within a bash script
  • Using fdisk and mkfs to manage the target workstation's hard drives
  • Using the Image Engine in bash scripts
  • Reading and writing to Image Safe Data.

Training Level: 3 - Advanced

Duration: 3 Days

Key Objectives

Audience Summary

This class is intended for those ZCM Administrators and Network Engineers responsible for developing creative solutions to imaging related challenges. Any experience programming in a scripting language or 3rd generation language like Pascal, Basic, or COBAL is helpful but not required.

Course Prerequisites

This course assumes that the student has a full understanding of ZENworks Configuration Management architecture and its feature set. The student is assumed to have the following ZCM related skills:

  • Be able to navigate within and use the ZENworks Control Center without direct instruction.
  • Understand the use case for, and be able to configure ZENworks Image and Imaging Script Preboot Bundles.
  • Understand the purpose of, and be able to configure Imaging Hardware Rules.

These prerequisite skills are taught in the following two courses:

  • Course 3118 - ZENworks 11.2.3 Configuration Management Administration
  • Course 8610 version 2 - Fundamentals of Imaging in ZENworks Configuration Management

Course Outline

This three day course is designed to teach the capabilities of the bash scripting language and how it can be leveraged in providing creative solutions to complex imaging related problems. The following topics are presented in this three day lecture and hands-on course:

Overview of the bash environment

  • A little on the history of bash
  • How bash relates to ZCM Imaging

Understanding Linux I/O

  • How Linux handles character streams
  • Understanding STDIN, STDOUT, and STDERR

Interacting with Users in your Bash Scripts

  • Using the echo command
  • Using literals, variables, and other Linux commands in echo
  • Leveraging escape sequences in the echo command
  • Purpose of the read command
  • Using prompts and variables in the read command

Hands-on Lab

  • Interacting with the user in a bash script:
  • Using the following - the read command and echo command with escape sequences

Understanding Redirection, Piping, and Command Substitution in bash

  • Purpose of Redirection
  • Redirection Operators and their use
  • Creating and using pipelines in bash
  • Redirecting input using Here Documents
  • Command substitution - use and syntax

Manipulating Strings in bash

  • the cut command
  • using grep
  • the rev command
  • using the tr command
  • sorting records in bash
  • understanding and using the awk and sed commands

Hands-on Lab

  • Using Piping and Redirection:
  • Process the /etc/passwd file using pipelines consisting of the echo, cut, and sort commands

Hands-on Lab

  • Obtaining the MAC Address of a Workstation:
  • Use pipelines and command substitution containing the hwinfo, ifconfig, grep, and cut commands to print out the MAC address of the workstation on which the script is running

Hands-on Lab

  • Obtaining the MAC Address of a Workstation with Colon Characters Removed:
  • Use pipelines and command substitution containing the hwinfo, ifconfig, grep, cut, rev, and tr commands to print out the MAC address of a workstation using just the digits 0-9 and letters a-f.

Processing Text Files in bash

  • using the cat command and file redirection to read files
  • file descriptors defined
  • reading files using while and file descriptors
  • writing to files in bash
  • using the head and tail commands

Hands-on Lab

  • Selecting and Re-formatting File Records:
  • Use the TFTP Client in the ZCM Imaging Distro to download a file to the workstation. Process that file with the sed, awk, and sort commands to generate a file in which the records have a different format.

Declaring and Using Variables

  • Variables defined
  • Typing variables in bash declarations
  • Best practices regarding variable usage
  • Passing parameters to a script at launch time
  • Pre-defined read-only variables for parameter passing
  • Purpose and use of the shift command

Hands-on Lab

  • Understanding and Using Positional Parameters:
  • Demonstrate the parsing of parameters that are passed into a script when it is launched.

Using Conditional Constructs in bash scripting

  • Conditional processing defined
  • Syntax for the if statement
  • Nested and Compound if constructs
  • Using the test command in conditional constructs
  • Using the case statement

Using Looping Constructs in bash scripting

  • while loops in detail
  • using the for command
  • using expressions to control the for loop

Using Functions within your bash scripts

  • Functions defined and their use case
  • Syntax for using functions in your script

Hands-on Lab

  • Using Looping and Conditional Constructs and Functions:
  • Demonstrate the use of functions and while looping to process a text file one line at a time. Compare the workstation's MAC address with the addresses of workstations list in a formatted text file.

Managing the Workstation's File System in bash scripts

  • Accessing file systems with the mount command
  • Partitioning drives using fdisk
  • Using Here Documents to drive fdisk in scripts
  • Formatting partitions using the mkfs command
  • Using the Imaging Engine (img) to manage the file system

Launching imaging operations in your bash scripts

  • Using img mp
  • Using img rp
  • Using img ml
  • Using img rl
  • Managing Image Safe Data (ISD) using zisview and zisedit

Challenge Lab #1

  • Managing a Workstation's File System and Performing Local Imaging Operations:
  • This lab will demonstrate using an imaging script to determine the number of formatted partitions on the local machine> And if a second partition does not exist, partition and format the second partition using a file system that will not be seen by the user when the machine is booted into Windows. Then be able to backup the primary Windows partition to this second local partition and be able to restore the Windows partition using the zmg image file stored in that second partition.

Challenge Lab #2

  • Image a Windows 7 Workstation and Set its Computer Name during the Imaging Operation:
  • This lab will demonstrate restoring a sysprepped Windows 7 SP1 base image to a machine followed by using the BIOS information of that machine to detect what Hardware Driver Add-on Image should be restored after the base image. Once the proper Driver Add-on Image is restore the imaging script will construct a Computer Name for that machine based on its MAC address that is used as an index into a text file containing the desired Computer Name for the machine having that detected MAC Address. The desired Computer Name is written to ISD where the ZENworks Adaptive Agent will read ISD and assign that Computer Name in the Windows OS itself.

Course Description