Scenario

This TID details a scenario where a company has sites in 3 different countries and wants to use a single Imaging Toolkit project to maintain consistency.

ENGL TID-2015002 looks at using subnets to identify the site-specific information; in this TID the IP address of the ZENworks server (PROXYADDR) is used.

In this example each site is on a different subnet and has a different imaging server. The company wishes to set the following settings dynamically based on the location of the machine being deployed:

  • Timezone
  • Locale (language settings)
  • Department (used for AD and ZCM registration)

In addition, they also want to be able to alter the default site selection in order to build machines for different locations.


By using this TID as a guideline it should be straightforward to modify the scenario to meet your own specific requirements.

Procedure

  1. Update the Zim script (zim.cfg) to identify the current location of the machine using the PROXYADDR variable
  2. Read the site-specific information from a lookup file
  3. Stored the information to ZENworks Image safe Data (ZISD)
  4. Modify the project settings to use environment variables for the settings that are to be set dynamically and recreate the build proces (Ztoolkit) image.
  5. Deploy and test
WARNING! Changes should be tested in a non-production environment and all files backed up before making any alterations.
Done Task
 
1. Create site lookup file
 
2. Update zimget.s/zimpeget.cmd to retrieve site lookup file
 
3. Modify Zim script (zim.cfg) to read site lookup file and store information to ZISD
 
4. Modify project settings to use variables
 
5. Create and deploy new Ztoolkit image
 
6. Test


  1. Create site lookup file

    Create a site lookup file called sites.ini in the tftp/zimfiles folder on the ZENworks server.

    NOTE: On Windows servers this will be:
       %ZENWORKS_HOME%\share\tftp\zimfiles\sites.ini

    and on Linux:
       /srv/tftp/zimfiles/sites.ini

    This file contains multiple sections. The first section is a list of PROXYADDR values and the sites where they are located. The remaining sections contain the information for the site name found in the first section.
    NOTE: PROXYADDR is the IP address of the ZENworks server and is set automatically when a machine PXE boots.

    For example:

    ; ENGL Sites Lookup File (sites.ini)
    ;
    ; Format:
    ;
    ; [PROXYADDR] section
    ; <Imaging proxy address> = <Site Name>
    ;
    ; [<Site Name>] sections
    ; Country = Short country code
    ; SITE = Active Directory OU and ZCM registration Key
    ; TZ = Time zone
    ; SL = System / User locale
    ; IL = Input locale
    ; DEPT = Departments (comma separated list)
    
    [PROXYADDR]
    10.40.1.2 = New York
    10.30.1.2 = Paris
    10.20.0.4 = London
    
    [New York]
    Country = US
    SITE = New York
    TZ = Eastern Standard Time
    SL = en-US
    IL = 0409:00000409
    DEPT = HR, Training, Administration
    
    [Paris]
    Country = FR
    SITE = Paris
    TZ = Romance Standard Time
    SL = fr-FR
    IL = 040C:0000040C
    DEPT = Administration, Staff
    
    [London]
    Country = UK
    SITE = London
    TZ = GMT Standard Time
    SL = en-UK
    IL = 0809:00000809
    DEPT = HR, Training, Administration, Development
    


  2. Update zimget.s/zimpeget.cmd to retrieve the site lookup file

    If you are using ZENworks (img) imaging, then the zimget.s file is found in the tftp/zimfiles folder on the ZENworks imaging server and is used to download the files from the server into the imaging environment.

     Update the file to include the line highlighted in green below:

    echo Downloading ENGL Zim files...
    tftp $PROXYADDR  /dev/null
    verbose on
    bin
    get zimfiles/ldapsdk.tar $ZIMDIR/ldapsdk.tar
    get zimfiles/zim.tgz /zimbin/zim.tgz
    get zimfiles/engl.lic $ZIMDIR/engl.lic
    get zimfiles/zim.cfg $ZIMDIR/zim.cfg
    get zimfiles/images.ini $ZIMDIR/images.ini
    get zimfiles/projects.ini $ZIMDIR/projects.ini
    get zimfiles/zimrun.s $ZIMDIR/zimrun.s
    get zimfiles/sites.ini $ZIMDIR/sites.ini
    quit
    _END_
    
     Save the changes to the zimget.s file.

    If you are using WinPE imaging, then the zimpeget.cmd file is found in the tftp/zimfiles folder on the ZENworks imaging server and is used to download the files from the server into the imaging environment.

     Update the file to include the sites.ini entry highlighted in green in the last line of code below:

    REM TFTP files
    if %PLATFORM%==x64 (
    for %%i in (Microsoft.VC80.CRT.manifest msvcm80.dll msvcp80.dll msvcr80.dll) do Ztftpclient.exe /get /host:%PROXYADDR% /remote:"zimfiles/%PLATFORM%/%%i" /local:%%i >NUL
    )
    for %%i in (zim.exe ztrace.exe) do Ztftpclient.exe /get /host:%PROXYADDR% /remote:"zimfiles/%PLATFORM%/%%i" /local:%%i >NUL
    for %%i in (engl.lic zim.cfg zim.jpg images.ini projects.ini clones.ini sites.ini) do Ztftpclient.exe /get /host:%PROXYADDR% /remote:"zimfiles/%%i" /local:%%i >NUL
    
     Save the changes to the zimpeget.cmd file.

  3. Modify Zim script (zim.cfg) to read site lookup file and store information to ZISD

    Update the tftp/zimfiles/zim.cfg file with the following changes:

    • Identify the site using the PROXYADDR variable

      Add an entry in the zim.cfg file after the network information has been identified as shown in green below:

      ; Get network info
      Network:Get,eth0,IPADDR,Network_IP
      Network:Get,eth0,NETMASK,Network_Mask
      Network:Get,eth0,HWADDR,Network_Mac
      ; Read in current location from sites.ini
      File:Ini,Get,"/zimbin/sites.ini","PROXYADDR","%PROXYADDR%",lookup_site
      
    • Update "Hardware Detected" form to include a site drop down list

      The changes (shown in green) below will add a list of the sites to the form. The list will default to the current site based on the PROXYADDR information above.

      ; Launch a Form to display detected hardware and select machine type
      Form:Start,"Info","Hardware Detected","_OkCancel^_Ok",Blue
      Form:Item,"Item1",Label,"Manufacturer"
      Form:Item,"Item2",EditBox,"%Lookup_Section%",ReadOnly
      Form:Item,"Item3",Label,"Model"
      Form:Item,"Item4",EditBox,"%Lookup_Value%",ReadOnly
      Form:Item,"Item5",Label,"Hardware Image"
      Form:Item,"Item6",EditBox,"%Drivers_Image%",ReadOnly
      Form:Item,"Item7",Label,"Hardware Type"
      Form:Item,"Item8",EditBox,"%Machine_Type%",ReadOnly
      Form:Item,"Item9",Label,"OS"
      Form:Item,"Item10",EditBox,"%Project_OS%",ReadOnly
      Form:Item,"Item11",Label,"Computer Name"
      Form:Item,"Item12",EditBox,"%Ask_COMPUTERNAME%"
      Form:Item,"Site1",Label,"Site:"
      Form:Item,"Site2",ListBox_File,"%lookup_site%","/zimbin/sites.ini","PROXYADDR","=",2
      Form:Item,"Item13",Label,"Auto Restart after imaging"
      Form:Item,"Item14",RadioButtons,"Yes","Yes,No"
      Form:Display,"Info"
      
    • Save selected site

      When a form is submitted, variables are created and set to the values of each form item. See the Imaging Toolkit documentation for more information.

       Create a new variable to hold the value of the selected site as shown below in green:

      If:Var,_Form,EQ,"_Cancel"
      Menu:Return
      End:
      Set:Ask_COMPUTERNAME,"%_Info_item12%"
      Set:ask_site,%_Info_Site2%
      Set:AutoRestart,"%_Info_item14%"
      
    • Read in site-specific information

      Now that the site has been identified Zim must gather the site-specific information by adding the following lines:

      ;Read site lookup file (sites.ini)
      Set:SiteIniPath,"%_ZimDir%sites.ini"
      File:Ini,Get,"%SiteIniPath%","%ask_site%","Country",lookup_Country
      File:Ini,Get,"%SiteIniPath%","%ask_site%","SITE",lookup_SITE
      File:Ini,Get,"%SiteIniPath%","%ask_site%","TZ",lookup_TZ
      File:Ini,Get,"%SiteIniPath%","%ask_site%","SL",lookup_SL
      File:Ini,Get,"%SiteIniPath%","%ask_site%","IL",lookup_IL
      
      
    • Update ZISD

      The information read in must now be stored to ZISD so that it can be used during the Windows build process:

      ; Update VendorDataENGL (sample)
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Machine_Type","%Machine_Type%")
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","OS","%Project_OS%")
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Project","%Lookup_Project%")
      ;Add site values to VendorDataENGL string
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Country","%lookup_Country%")
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","SITE","%lookup_SITE%")
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","TZ","%lookup_TZ%")
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","SL","%lookup_SL%")
      Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","IL","%lookup_IL%")
      
      
       Save the changes to the zim.cfg file.


  4. Modify project settings to use variables

    Nearly every setting in a project can be configured to use a variable. In this example the company wishes to control the localisation and registration settings using variables.

     By default the phase0-before.vbs script in a project will export all values stored in VendorDataENGL as Windows environment variables with a prefix of "ENGL_" so it is a simple matter of modifying the project settings to use these values.

    • Configure localisation settings

      • Launch Build Console

      • Open the project

      • Select the Expert View

      • Select the Windows - Localisation section

      • Set the appropriate Build Variables

        Image ./images/tid-2015001-Localisation.png not found.
      • Save the changes to the project

    • Active Directory join to a specific OU

      • Launch Build Console

      • Open the project

      • Select the Expert View

      • Select the Windows - Active Directory / Workgroup section

      • Update the OU entry to use the appropriate variable(s)

        Image ./images/tid-2015001-DomainOU.png not found.
      • Save the changes to the project

    • ZCM registration to a specific folder

      • Configure a ZENworks Registration key

         Instructions on how to create ZENworks registration keys can be found in the ZENworks Documentation. These are used to control which folder a workstation object is registered into.

        NOTE: To make management easier ensure folders and keys are created with names rather than using a GUID

        Image ./images/tid-2015001-ZEN_Registration_Key.png not found.
      • Update the project

        • Launch Build Console

        • Open the project

        • Select the Expert View

        • Select the Windows - Active Directory / Workgroup section

        • Update the OU entry to use the appropriate variable(s)

          Image ./images/tid-2015001-DomainOU.png not found.
      • Save the changes to the project

  5. Create and deploy new Ztoolkit image

    • Launch Build Console

    • Open the project

    • Run the Deployment Wizard

    • Select the option to create Build Process images

    • Select the option to create the Build Process (ztoolkit) image

    • Once complete copy the new Ztoolkit image to the server

  6. Test

    Both Zim and the project have now been configured to identify and use site-specific information.
     To test everything is working do the following:

    • PXE boot a machine into Zim

    • Select the Restore menu

    • Select the project

    • When prompted confirm the computer name and note that the current site has automatically been selected

    • Continue to restore all images and allow the machine to build

    • Once the machine has built successfully log in and confirm the site-specific settings have been applied successfully

  7.  If there are issues with the process review both the zim.log and ztoolkit.log to see where / what has failed to happen.
     For more information about the log files review ENGL TID-2013016


If you have any problems or questions about the steps in this TID please contact the ENGL support team