Issue

During the build process the ZCM server is checked to ensure it is available prior to registration occuring.

If the server check fails the build process will fail.

Requirements

  • Imaging Toolkit

  • ZCM Environment with multiple primary servers

Solution

Carry out an initial server check before phase 2 against a list of ZCM primary servers. The name of the first server that is available is used to populate an environment variable (%Primary_server%). This variable is used in the registration command during workstation registration.

If the first entry in the list is not available the script will continue through the list until a valid server is found or all servers have been checked.

Procedure

Done Task
 
1. Update phase2-before.vbs script file
 
2. Modify project setting to use a variable
 
3. Create and deploy new Ztoolkit image
 
4. Test



  1. Update phase2-before.vbs script file


    • Launch Build Console

    • Open the project

    • Select the Expert View

    • Select Customisations - Custom Files

    • Right click on phase2-before.vbs - then select Edit

    • Update the file to reflect the following changes

      The configuration values highlighted in red need to be updated with information appropriate to your environment:
      ' ENGL Build Console
      ' Copyright (C) 1999-2017 Expert Networking Group Limited
      '
      ' Custom script template (phase2-before.vbs)
      
      
      ' Attach to ENGL Ztoolkit ActiveX Control
      Set LDAP = CreateObject("ENGL.Ztoolkit.LDAP")
      Set Utils = CreateObject("ENGL.Ztoolkit.Utils")
      Set ZENworks = CreateObject("ENGL.Ztoolkit.ZENworks")
      
      'configure activx controls
      Set WshShell = WScript.CreateObject("WScript.Shell")
      
      ' Set ZISD Version
      ZENworks.ZISDVersion = 11
      
      ' Add custom script here...
      
      
      ' Define how many ZCM primary servers will be checked
      Dim Primary_servers (4)
      
      ' List Primary servers in order of preference of use
      Primary_servers(0) = "labsrv.engllab.com"
      Primary_servers(1) = "suppzcm4.englsupp.local"
      Primary_servers(2) = "192.168.120.1"
      Primary_servers(3) = "labsrv.engllab.co.uk"
      
      ' Check servers
      For Each item In Primary_servers
          
          ' Read in server to check
          check_server = item
          Utils.AppendLog "###############################################"
          Utils.AppendLog "Checking " & check_server
      
          ' Set Primary_Server variable
          Utils.SetSystemEnvironmentVariable "Primary_server", check_server
      
          ' Launch isserver check
          Set WshShellScriptExec = WshShell.Exec("C:\Ztoolkit\zsoaplibbridge.exe isserver")
          Utils.appendlog "Waiting for " & check_server & " to respond or time out"
          Do While WshShellScriptExec.Status = WshRunning
              Utils.Delay 5
          Loop
          strPingResults = LCase(WshShellScriptExec.StdOut.ReadAll)
          Utils.AppendLog "Status : " & WshShellScriptExec.ExitCode
          If WshShellScriptExec.ExitCode = 0 Then
              Utils.AppendLog "ZCM server check against " & check_server & " has been successful"
              Exit For
          Else
              Utils.AppendLog "ZCM server check against " & check_server & " has failed"
          End If
      Next
      
      Utils.AppendLog "All server checks are now complete"
      Utils.AppendLog "###############################################"
      
      
    • Save the changes to the phase2-before.vbs script 
  2. Modify project setting to use a variable

    • Launch Build Console 
    • Open the project 
    • Select the Expert View 
    • Select ZENworks - Registration 
    • Replace the existing server details with the variable %Primary_server%
    • Save the project 
  3. 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 
  4. Test

    • Test the updated build process to confirm it is completing and that the any issues with ZCM registration have been resolved. 
    • Review the ztoolkit.log file - this will indicate which server was found to be available and was used in phase2 for ZCM registration