jamie glendinning [email protected] engl imaging toolkit™ 6 advanced zenworks imaging...
TRANSCRIPT
Jamie [email protected]
ENGL Imaging Toolkit™ 6Advanced ZENworks imaging integration and scripting
Copyright © Expert Networking Group Limited2
Agenda
Introduction
Zim
Scenarios
•Capture img error codes to zim.log file
•Changing image restore locations
•Password protect dynamic Zim restore menu
•Dynamic development menu
•How to use VMware snapshots with Zim
•Selecting owner of machine from AD using search filters
Copyright © Expert Networking Group Limited3
Introduction
Copyright © Expert Networking Group Limited4
Introduction
Level Intermediate
Duration 30 minutes
AssumptionsAn understanding of the ENGL build process
Copyright © Expert Networking Group Limited5
Zim
Copyright © Expert Networking Group Limited6
Zim
What is Zim? Zim is a front end to the ZENworks imaging environment
Zim is designed to simplify, secure and automate ZENworks imaging tasks.
Using Zim, imaging tasks can be delivered based on user credentials from the corporate LDAP directory.
These tasks can automate complex naming, partition and imaging tasks whilst the user is presented with a simple set of menu options.
Copyright © Expert Networking Group Limited7
Zimzim.cfg
The zim.cfg file that is created by the Imaging Toolkit 6 Build Console / Integration Wizard and will cover most basic customer requirements:
• Multiple projects • Different OS’s
• Same OS – different build configurations
• Computer naming prompt
• Restore appropriate image files
• Restore appropriate driver image based on OS and Hardware filters
Copyright © Expert Networking Group Limited8
Zimzim.cfg
The zim.cfg file is a script file.
It can be customised to meet the requirements of individual customers.
The functions used to develop and extend the zim.cfg file can be found on the ENGL website:
http://www.engl.co.uk/documentation/imagingtoolkit/6.0/zim/ref.html
Copyright © Expert Networking Group Limited9
ScenarioCapture img error codes to zim.log file
Copyright © Expert Networking Group Limited10
ScenarioCapture img error codes to zim.log file
Zim will record img error codes to the zim.log file (if it is configured) however an error code does not always help if it is unclear what the error code number means.
With ZCM 10.3.x and newer it is possible to review the imglogr file in the imaging environment to identify what img believes the issue is.
Each time img is launched the imglogr file gets overwritten.
Copyright © Expert Networking Group Limited11
ScenarioCapture img error codes to zim.log file
To record this information configure Zim to append to the zim.log file.
To do this update the zim.cfg file with the following:
File:Run,"cat imglogr >> /zimbin/zim.log",verbose
after each img command you want to capture the error information on.
Copyright © Expert Networking Group Limited12
ScenarioCapture img error codes to zim.log file
Dialog:Popup,"Restoring ENGL Smart Windows build process, please wait...",green Pause:3 File:Run,"img %imgrestorecmd%%project_image_path%/%base_image%",verbose File:Run,"cat imglogr >> /zimbin/zim.log",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/hotfixes.zmg",verboseFile:Run,"cat imglogr >> /zimbin/zim.log",verboseIf:Var,machine_type,eq,"tablet"
File:Run,"img %imgrestorecmd%%project_image_path%/tablet.zmg",verbose File:Run,"cat imglogr >> /zimbin/zim.log",verbose
End: File:Run,"img %imgrestorecmd%%project_image_path%/%project_novcomp%",verbose File:Run,"cat imglogr >> /zimbin/zim.log",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/%project_ztoolkit%",verboseFile:Run,"cat imglogr >> /zimbin/zim.log",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/%drivers_image%",verbose File:Run,"cat imglogr >> /zimbin/zim.log",verbosePause:2 Dialog:Popupclose
Update the zim.cfg file so the new command is after each img command you want to capture the error information on.
Copyright © Expert Networking Group Limited13
ScenarioCapture img error codes to zim.log file
[15-Apr-11 12:43:32] [Zim] [Debug] > SET [_error] to [0][15-Apr-11 12:43:32] [Zim] [Debug] 0471 -[File:Run,"img %imgrestorecmd%%project_image_path%/%project_ztoolkit%","verbose"][15-Apr-11 12:43:32] [Zim] [Debug] +[File:Run,"img -r -p 5173-xpsp3/ztoolkit.zmg","verbose"][15-Apr-11 12:43:40] [Zim] [Debug] nCode = 1[15-Apr-11 12:43:40] [Zim] [Debug] > SET [_error] to [1][15-Apr-11 12:43:40] [Zim] [Debug] 0472 -[File:Run,"cat imglogr >> /zimbin/zim.log","verbose"]
Novell ZENworks Imaging Engine v10.3.1.0(c) Copyright 1999-2010, Novell, Inc.All rights reserved.
Image restored: 5173-xpsp3/ztoolkit.zmg from 192.168.120.1 Elapsed time: 00:06 New image successful
[15-Apr-11 12:43:40] [Zim] [Debug] nCode = 0
Sample zim.log file
Copyright © Expert Networking Group Limited14
ScenarioChanging image restore locations
Copyright © Expert Networking Group Limited15
ScenarioChanging image restore locations
When restoring projects all image files are expected to be found in the ../content-repo/images/<project> folder structure.
This is very easy to manage however if there is more than one project with the same OS there can be a lot of duplicated files within the project structures.
Copyright © Expert Networking Group Limited16
ScenarioChanging image restore locations
It is possible to modify the image restore folder structure so OS specific files are separate from project files and update Zim so that it knows where to restore files from.
Copyright © Expert Networking Group Limited17
ScenarioChanging image restore locations
Dialog:Popup,"Restoring ENGL Smart Windows build process, pleasewait...",greenPause:3File:Run,"img %imgrestorecmd%%project_image_path%/%base_image%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/hotfixes.zmg",verboseIf:Var,machine_type,eq,"tablet"
File:Run,"img %imgrestorecmd%%project_image_path%/tablet.zmg",verboseEnd:File:Run,"img %imgrestorecmd%%project_image_path%/%project_novcomp%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/%project_ztoolkit%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/%drivers_image%",verbosePause:2Dialog:Popupclose
Update the zim.cfg file to change the restore paths for the base image and drivers image
Dialog:Popup,"Restoring ENGL Smart Windows build process, pleasewait...",greenPause:3File:Run,"img %imgrestorecmd%os/%project_os%/%base_image%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/hotfixes.zmg",verboseIf:Var,machine_type,eq,"tablet"
File:Run,"img %imgrestorecmd%%project_image_path%/tablet.zmg",verboseEnd:File:Run,"img %imgrestorecmd%%project_image_path%/%project_novcomp%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/%project_ztoolkit%",verboseFile:Run,"img %imgrestorecmd%os/%project_os%/%drivers_image%",verbosePause:2Dialog:Popupclose
Copyright © Expert Networking Group Limited18
ScenarioChanging image restore locations
Move the base image files, driver images and HAL image files into the appropriate OS/<project_os> folders
Copyright © Expert Networking Group Limited19
ScenarioPassword protect dynamic Zim restore menu
Copyright © Expert Networking Group Limited20
ScenarioPassword protect dynamic Zim restore menu
When configuring a standard menu item within Zim it is possible to specify a simple password to protect this menu item.
It is not possible to specify a simple password with the dynamic menu items that are created based on the projects.ini file.
It is possible to modify the zim.cfg file to prompt for the appropriate password once the dynamic menu item has been selected. The password is stored in an additional field in the projects.ini file
Copyright © Expert Networking Group Limited21
ScenarioPassword protect dynamic Zim restore menu
Update the zim.cfg file with the following information:
Set:lookup_project,%_project_item2
Label:lookup_project_info ; Validate password if set in projects.ini file Set:pw_login_count,"0" Set:pw_login_count_max,"2" File:Ini,Get,"/zimbin/projects.ini","%lookup_project%","project_password",project_password
label:validate_password If:var,project_password,ne,"" ; password has been set ; Display password prompt Dialog:InputPass,"Enter password:",prompt_password,RED if:var,prompt_password,ne,"%project_password%" Set:pw_login_count,math(+, 1) If:Var,pw_login_count,gt,"%pw_LOGIN_COUNT_MAX%" Dialog:Ask,"Menu Lockout!","You have failed to authenticate 3 times.\n \nPress a key to return to the main menu.","_Ok","red" menu:return End: goto:validate_password End: End:
; Read in project specific information File:Ini,Get,"/zimbin/projects.ini","%lookup_project%","project_image_path",project_image_pathFile:Ini,Get,"/zimbin/projects.ini","%lookup_project%","project_os",project_os File:Ini,Get,"/zimbin/projects.ini","%lookup_project%","base_image",base_image File:Ini,Get,"/zimbin/projects.ini","%lookup_project%","ztoolkit",project_ztoolkit File:Ini,Get,"/zimbin/projects.ini","%lookup_project%","novcomp",project_novcomp
Copyright © Expert Networking Group Limited22
ScenarioPassword protect dynamic Zim restore menu
Update the projects.ini file with the following “project_password = value”:
;; ENGL Zim projects.ini lookup file;
[projects]project1 = Techbite drivers demo - Win 7project2 = Windows 7 Enterprise (x86) - en-USproject3 = xpsp3-test
; Project details[Techbite drivers demo - Win 7]Description = Techbite drivers demo - Win 7project_image_path = techbite-drivers-win7project_os = win7-ent-x86base_image = win7-ent-x86-postspztoolkit = ztoolkit.zmgnovcomp =project_password = P@ssw0rd
[Windows 7 Enterprise (x86) - en-US]Description = Windows 7 Enterprise (x86) - en-USproject_image_path = win7-demoproject_os = win7-ent-x86base_image = win7-ent-x86-postspztoolkit = ztoolkit.zmgnovcomp = novcomp.zmgproject_password = P@ssw0rd2
[xpsp3-test]Description = xpsp3-testproject_image_path = xpsp3-testproject_os = winxp-x86base_image = winxp-x86-postspztoolkit = ztoolkit.zmgnovcomp = novcomp.zmgproject_password =
Copyright © Expert Networking Group Limited23
ScenarioPassword protect dynamic Zim restore menu
Note: The project_password attribute needs to be set on each project section. Zim will error if it is not available. The password does not need to be populated on each entry.
Copyright © Expert Networking Group Limited24
ScenarioPassword protect dynamic Zim restore menu
Project Password
Techbite drivers demo - Win 7 P@ssw0rd
Windows 7 Enterprise (x86) - en-US P@ssw0rd2
xpsp3-test
Copyright © Expert Networking Group Limited25
DemoPassword protect dynamic Zim restore menu
Copyright © Expert Networking Group Limited26
ScenarioPassword protect dynamic Zim restore menu
Copyright © Expert Networking Group Limited27
ScenarioDynamic development menu
Copyright © Expert Networking Group Limited28
ScenarioDynamic development menu
Zim uses the projects.ini file to populate a dynamic restore menu
When testing a project it is not always appropriate for the project to be available in this restore menu
It is possible to modify the projects.ini file and the Development menu configuration in the zim.cfg file to separate test and live project restore options
Copyright © Expert Networking Group Limited29
ScenarioDynamic development menu
Update the projects.ini file with the following information:; ; ENGL Zim projects.ini lookup file;
[projects]project1 = Techbite drivers demo - Win 7project2 = Windows 7 Enterprise (x86) - en-USproject3 = xpsp3-test
; Project details[Techbite drivers demo - Win 7]Description = Techbite drivers demo - Win 7project_image_path = techbite-drivers-win7project_os = win7-ent-x86base_image = win7-ent-x86-postspztoolkit = ztoolkit.zmgnovcomp =
[Windows 7 Enterprise (x86) - en-US]Description = Windows 7 Enterprise (x86) - en-USproject_image_path = win7-demoproject_os = win7-ent-x86base_image = win7-ent-x86-postspztoolkit = ztoolkit.zmgnovcomp = novcomp.zmg
[xpsp3-test]Description = xpsp3-testproject_image_path = xpsp3-test1project_os = winxp-x86base_image = winxp-x86-postspztoolkit = ztoolkit.zmgnovcomp = novcomp.zmg
; ; ENGL Zim projects.ini lookup file;
[projects]project1 = Techbite drivers demo - Win 7project2 = Windows 7 Enterprise (x86) - en-US
[Development]project1 = xpsp3-test
; Project details[Techbite drivers demo - Win 7]Description = Techbite drivers demo - Win 7project_image_path = techbite-drivers-win7project_os = win7-ent-x86base_image = win7-ent-x86-postspztoolkit = ztoolkit.zmgnovcomp =
[Windows 7 Enterprise (x86) - en-US]Description = Windows 7 Enterprise (x86) - en-USproject_image_path = win7-demoproject_os = win7-ent-x86base_image = win7-ent-x86-postspztoolkit = ztoolkit.zmgnovcomp = novcomp.zmg
[xpsp3-test]Description = xpsp3-testproject_image_path = xpsp3-test1project_os = winxp-x86base_image = winxp-x86-postspztoolkit = ztoolkit.zmgnovcomp = novcomp.zmg
Copyright © Expert Networking Group Limited30
ScenarioDynamic development menu
Update the zim.cfg file with the following information:
; Development Menu
Menu:Start,mnu_dev,"Development Menu","Red"Menu:Item,dev_make_image,"Make an image"Menu:Item,dev_restore_image,"Restore an image"Menu:SeparatorMenu:Item,_previous,"Return to Maintenance Menu"Menu:Item,_top,"Return to Main Menu"
; Development Menu
Menu:Start,mnu_dev,"Development Menu","Red"; Enable variable expansion in menu, item title and item params and before adding menu item Set:_MenuExpandTitleVariables,"true"Set:_MenuExpandItemParamsVariables,"true"
; Get first project section nameSet:devIndex,1Set:devKey,“project%devIndex%“File:Ini,Get,"projects.ini","Development","%devKey%",devSection
While:Var,devSection,ne,"“; Get project detailsFile:Ini,Get,"projects.ini","%devSection%","Description",devDescription; Add menu itemMenu:Item,restore_ztoolkit_begin,"%devDescription%","","%devDescription%“; Next project sectionSet:devIndex,Math("+", 1)Set:devKey,"dev%devIndex%“File:Ini,Get,"projects.ini","Development","%devKey%",devSection
Wend:
; Disable variable expansion in menu, item title and item params and after adding menu item Set:_MenuExpandTitleVariables,"false"Set:_MenuExpandItemParamsVariables,"false“Menu:SeparatorMenu:Item,dev_make_image,"Make an image"Menu:Item,dev_restore_image,"Restore an image"Menu:SeparatorMenu:Item,_previous,"Return to Maintenance Menu"Menu:Item,_top,"Return to Main Menu"
Copyright © Expert Networking Group Limited31
DemoStandard development menu
Copyright © Expert Networking Group Limited32
ScenarioDynamic development menu
Copyright © Expert Networking Group Limited33
DemoDynamic development menu
Copyright © Expert Networking Group Limited34
ScenarioDynamic development menu
Copyright © Expert Networking Group Limited35
ScenarioHow to use VMware snapshots with Zim
Copyright © Expert Networking Group Limited36
ScenarioHow to use VMware snapshots with Zim
When testing in a VMware environment it is more efficient to revert to a snapshot of a base image than restore the entire image from the ZENworks imaging server.
Zim can be configured to bypass restoration of the base image if the client machine is running within a virtual machine.
Copyright © Expert Networking Group Limited37
ScenarioHow to use VMware snapshots with Zim
To configure the virtual machine
•PXE boot to Zim menu
•Select Maintenance Menu
•Select Development Menu
•Select Restore an image
•Select <project> from list
•Enter base image name and restore it
•Shut down machine
•Make a VMware snapshot of machine
Copyright © Expert Networking Group Limited38
ScenarioHow to use VMware snapshots with Zim
Update the zim.cfg file with the following information:
Form:Display,"Info"If:Var,_Form,Eq,"_Cancel"
Menu:ReturnEnd:Set:Ask_COMPUTERNAME,%_Info_item7%Set:AutoRestart,%_Info_item9%If:Var,Ask_COMPUTERNAME,ne,"%COMPUTERNAME%"
Set:COMPUTERNAME,"%Ask_COMPUTERNAME%"End:
Dialog:Ask,"", "Warning! All hard disk data on this machine will be erased.\n \nContinue?","_YesNo",redIf:Var,_ask,eq,"_No"
Menu:ReturnEnd:
Dialog:Popup,"Restoring ENGL Smart Windows build process, please wait...",greenPause:3File:Run,"img %imgrestorecmd%%project_image_path%/%base_image%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/hotfixes.zmg",verbose
Form:Display,"Info"If:Var,_Form,Eq,"_Cancel"
Menu:ReturnEnd:Set:Ask_COMPUTERNAME,%_Info_item7%Set:AutoRestart,%_Info_item9%If:Var,Ask_COMPUTERNAME,ne,"%COMPUTERNAME%"
Set:COMPUTERNAME,"%Ask_COMPUTERNAME%"End:; If machine is a VMWare machine - prompt for base image to restore (allows for snapshot workaround)If:Var,lookup_section,contains,"vmw"
; Launch a Form to display detected hardware and select machine type Form:Start,"vmware","Select Base image to use","_OkCancel^Ok”Form:Item,"Item1",StaticText,"VMWare Machine detected" Form:Item,"Item2",Label,"Select Base Image type :" Form:Item,"Item3",RadioButtons,"","Restore Image, Snapshot" Form:Display,"vmware" If:Var,_Form,Eq,"_Cancel"
Menu:Return End: If:var,_vmware_item3,eq,"Snapshot"
set:base_image,"" End:
End:Dialog:Ask,"", "Warning! All hard disk data on this machine will be erased.\n \nContinue?","_YesNo",redIf:Var,_ask,eq,"_No"
Menu:ReturnEnd:
Dialog:Popup,"Restoring ENGL Smart Windows build process, please wait...",greenPause:3File:Run,"img %imgrestorecmd%%project_image_path%/%base_image%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/hotfixes.zmg",verbose
Copyright © Expert Networking Group Limited39
DemoHow to use VMware snapshots with Zim
Copyright © Expert Networking Group Limited40
ScenarioHow to use VMware snapshots with Zim
Copyright © Expert Networking Group Limited41
ScenarioHow to use VMware snapshots with Zim
Copyright © Expert Networking Group Limited42
ScenarioSelecting owner of machine from AD using search filters
Copyright © Expert Networking Group Limited43
ScenarioSelecting owner of machine from AD using search filters
It is sometimes useful to identify the owner of a machine at imaging in order to fully customise the machine for that user account.
The easiest way to do this is to configure an LDAP query in a Zim form. This will present the user with a list of user accounts, one of which can be selected and the appropriate information stored to ZISD
Copyright © Expert Networking Group Limited44
ScenarioSelecting owner of machine from AD using search filters
Modify the standard zim.cfg file; Authenticate to LDAP serverLDAP:Init,"labsrv.engllab.local",389
LDAP:Bind,"cn=Administrator,CN=users,DC=engllab,DC=local","P@ssw0rd"If:Var,_error,eq,1 Dialog:Ask,"LDAP Bind Error","%_ldaperrorstr%","_any",RED LDAP:Unbind Goto:TheEndEnd:
; Launch a Form to display detected hardware and select machine typeForm:Start,"Info","Hardware Detected","_OkCancel^_Ok",BlueForm:Item,"Item1",StaticText,"-Manufacturer : %lookup_section%"Form:Item,"Item2",StaticText,"-Model : %lookup_value%"Form:Item,"Item3",StaticText,"-Hardware Image : %drivers_image%"Form:Item,"Item4",StaticText,"-Hardware Type : %machine_type%"Form:Item,"Item5",StaticText,"-OS : %project_os%"Form:Item,"Item6",Label,"Computer Name :"Form:Item,"Item7",EditBox,"%COMPUTERNAME%"Form:Item,"Item8",Label,"Select Owner :"Form:Item,"item9",ListBox_LDAP,"","OU=users,OU=itz6,DC=engllab,DC=local",ONELEVEL,"(objectclass=Person)","cn"Form:Item,"Item10",Label,"Auto Restart after imaging:"Form:Item,"Item11",Radiobuttons,"Yes","Yes,No"Form:Display,"Info"If:Var,_Form,Eq,"_Cancel"
Menu:ReturnEnd:Set:Ask_COMPUTERNAME,%_Info_item7%Set:ask_owner,%_Info_item9%Set:AutoRestart,%_Info_item11%If:Var,Ask_COMPUTERNAME,ne,"%COMPUTERNAME%"
Set:COMPUTERNAME,"%Ask_COMPUTERNAME%"End:
Copyright © Expert Networking Group Limited45
ScenarioSelecting owner of machine from AD using search filters
; Update the information in ZISDZisd:Put,NetBiosName,%COMPUTERNAME%
; Update VendorDataENGLSet:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Machine_Type","%machine_type%")Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","OS","%project_os%")Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Project","%lookup_project%")Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Owner","%ask_owner%")
ZISD:Put,VendorDataENGL,"%VendorDataENGLSTRING%"Zisd:Write
Copyright © Expert Networking Group Limited46
ScenarioSelecting owner of machine from AD using search filters
Copyright © Expert Networking Group Limited47
ScenarioSelecting owner of machine from AD using search filters
This method is very useful as a starting point to querying AD but has some limitations:
AD by default limits LDAP queries to 1000 results
Need to scroll through each item to find the appropriate username
It is possible to extend the form to prompt for an attribute of the user account then use this attribute to filter the list of users:
First name
Surname
Copyright © Expert Networking Group Limited48
ScenarioSelecting owner of machine from AD using search filters
By filtering the query on an attribute the number of results is normally well within the 1000 record limit for AD LDAP queries and will result in a much shorter list to scroll through to select the appropriate user.
Copyright © Expert Networking Group Limited49
ScenarioSelecting owner of machine from AD using search filters
Modify the standard zim.cfg file; Read zisd:VendorDataENGLzisd:get,VendorDataENGL,VendorDataENGLSTRING
; Read stored information in from VendorDataENGLSet:zisd_project,GetKeyPairStringValue("%VendorDataENGLSTRING%", "project")Set:zisd_owner,GetKeyPairStringValue("%VendorDataENGLSTRING%", “Owner")Set:zisd_owner_firstname,GetKeyPairStringValue("%VendorDataENGLSTRING%", “Owner_firstname")Set:zisd_owner_surname,GetKeyPairStringValue("%VendorDataENGLSTRING%", “Owner_surname")
This reads in ZISD:VendorDataENGL and sets additional variables based on the info (if it exists) that is stored in the Owner key pair strings
Copyright © Expert Networking Group Limited50
ScenarioSelecting owner of machine from AD using search filters
Add LDAP authentication
Label:ztoolkit_computername
; Check for an AssetTag we can use for the DMI_NAMESet:DMI_NAME,""If:Var,dmi_board_asset,ne,""
Set:DMI_NAME,"%dmi_board_asset%"ElseIf:Var,dmi_chassis_asset,ne,""
Set:DMI_NAME,"%dmi_chassis_asset%"End:
Set:COMPUTERNAME,""; Read the Computername in from ZISD (if it exists)Zisd:Get,NetBiosName,ZISD_COMPUTERNAMEIf:Var,ZISD_COMPUTERNAME,ne,""
Set:COMPUTERNAME,%ZISD_COMPUTERNAME%Else:
Set:COMPUTERNAME,"%DMI_NAME%"End:
Label:ztoolkit_computername
; Check for an AssetTag we can use for the DMI_NAMESet:DMI_NAME,""If:Var,dmi_board_asset,ne,""
Set:DMI_NAME,"%dmi_board_asset%"ElseIf:Var,dmi_chassis_asset,ne,""
Set:DMI_NAME,"%dmi_chassis_asset%"End:
Set:COMPUTERNAME,""; Read the Computername in from ZISD (if it exists)Zisd:Get,NetBiosName,ZISD_COMPUTERNAMEIf:Var,ZISD_COMPUTERNAME,ne,""
Set:COMPUTERNAME,%ZISD_COMPUTERNAME%Else:
Set:COMPUTERNAME,"%DMI_NAME%"End:
; Authenticate to LDAP serverLDAP:Init,"labsrv.engllab.local",389
LDAP:Bind,"cn=Administrator,CN=users,DC=engllab,DC=local","P@ssw0rd"If:Var,_error,eq,1 Dialog:Ask,"LDAP Bind Error","%_ldaperrorstr%","_any",RED LDAP:Unbind Menu:ReturnEnd:
Copyright © Expert Networking Group Limited51
ScenarioSelecting owner of machine from AD using search filters
label:owner_form
; Launch a Form to prompt for machine OwnerForm:Start,"Owner","User Details","_NextCancel^_Next",BlueForm:Item,"Item1",StaticText,"Enter Owner details"Form:Item,"Item2",Label,"Firstname :"Form:Item,"Item3",EditBox,"%zisd_owner_firstname%"Form:Item,"Item4",Label,"Surname :"Form:Item,"Item5",EditBox,"%zisd_owner_surname%"Form:Item,"Item6",StaticText,"-Minimum 1 character in each box"Form:Display,"Owner"If:Var,_Form,Eq,"_Cancel"
Menu:ReturnEnd:
Set:ask_owner_firstname,%_owner_item3%Set:ask_owner_surname,%_owner_item5%
; Validate Owner info (need minimum of 1 character required for filter to be valid)
if:var,ask_owner_firstname,eq,""set:owner_valid,False
end:if:var,ask_owner_surname,eq,""
set:owner_valid,Falseend:if:var,owner_valid,eq,"False"
dialog:banner,"invalid Owner information detected \n Please re-enter",1,redset:owner_valid,""goto:owner_form
end:
Configure a Zim form to prompt for Owner information
Copyright © Expert Networking Group Limited52
ScenarioSelecting owner of machine from AD using search filters
label:validate_form; Launch a Form to display detected hardware and select machine typeForm:Start,"validate","Confirm Owner","_BackNextCancel^_Next",BlueForm:Item,"Item1",Label,"Select Owner :"Form:Item,"item2",ListBox_LDAP,"","DC=engllab,DC=local",SUBTREE,"(&(objectclass=Person)(givenName=%ask_owner_firstname%*)(sn=%ask_owner_surname%*)(!(objectclass=computer)))","sAMAccountName"Form:Item,"Item3",Label,"Check Yes to lookup local user details if required:"Form:Item,"Item4",Radiobuttons,"No","Yes,No"Form:Display,"validate"If:Var,_Form,Eq,"_Cancel"
Menu:ReturnEnd:If:Var,_Form,Eq,"_Back"
Goto:owner_formEnd:
Set:valid_owner,%_validate_item2%Set:valid_owner_dn,%_validate_item2_ldap_dn%Set:valid_check,%_validate_item4%
if:var,valid_owner,eq,""; Owner validation has failed - need to re-input Owner informationset:ask_owner_firstname,""set:ask_owner_surname,""dialog:banner,"Invalid Owner details detected \n Please re-enter",3,redGoto:owner_form
end:; Read in additional account attributes ; displayNameLDAP:GetAttr,"%valid_owner_dn%","displayName",ldap_displayName; userPrincipalNameLDAP:GetAttr,"%valid_owner_dn%","userPrincipalName",ldap_userPrincipalName; sAMAccountNameLDAP:GetAttr,"%valid_owner_dn%","sAMAccountName",ldap_sAMAccountName; givenNameLDAP:GetAttr,"%valid_owner_dn%","givenName",ldap_givenName; snLDAP:GetAttr,"%valid_owner_dn%","sn",ldap_sn
Validate Owner information and Display (if selected)
Copyright © Expert Networking Group Limited53
ScenarioSelecting owner of machine from AD using search filters
If:var,valid_check,eq,"Yes“; Launch a Form to validate local user entered prieviouslyForm:Start,"accountcheck","Additional local user lookup","_BackNextCancel^_Next",BlueForm:Item,"Item1",StaticText,"-The local user has been entered as : %valid_owner%"Form:Item,"Item2",StaticText,"-Additional information"Form:Item,"Item4",StaticText,"-Full Name : %ldap_displayName%"Form:Item,"Item5",StaticText,"-First Name : %ldap_givenName%"Form:Item,"Item6",StaticText,"-Surname : %ldap_sn%"Form:Item,"Item7",StaticText,"-AD Name : %ldap_userPrincipalName%"Form:Item,"Item8",StaticText,"-Account name : %ldap_sAMAccountName%"Form:Item,"Item9",StaticText,"-Click on back twice to re-enter the local user information"form:display,"accountcheck"If:var,_Form,eq,"_cancel"
Menu:ReturnEnd:If:var,_Form,eq,"_Back"
goto:validate_formEnd:
End:
; Launch a Form to display detected hardware and select machine typeForm:Start,"info","Confirm information","_BackFinishCancel^_Finish",BlueForm:Item,"Item1",StaticText,"-Manufacturer : %lookup_section%"Form:Item,"Item2",StaticText,"-Model : %lookup_value%"Form:Item,"Item3",StaticText,"-Hardware Image : %drivers_image%"Form:Item,"Item4",StaticText,"-Hardware Type : %machine_type%"Form:Item,"Item5",StaticText,"-OS : %project_os%"Form:Item,"Item6",StaticText,"-Owner : %valid_owner%"Form:Item,"Item7",Label,"Computer Name :"Form:Item,"Item8",EditBox,"%COMPUTERNAME%"Form:Item,"Item9",Label,"Auto Restart after imaging:"Form:Item,"Item10",Radiobuttons,"Yes","Yes,No"form:display,"info"Set:Ask_COMPUTERNAME,%_Info_item8%Set:AutoRestart,%_Info_item10%
If:Var,Ask_COMPUTERNAME,ne,"%COMPUTERNAME%"Set:COMPUTERNAME,"%Ask_COMPUTERNAME%"
End:
Display user and workstation details
Copyright © Expert Networking Group Limited54
ScenarioSelecting owner of machine from AD using search filters
Dialog:Popup,"Restoring ENGL Smart Windows build process, please wait...",greenPause:3File:Run,"img %imgrestorecmd%%project_image_path%/%base_image%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/hotfixes.zmg",verboseIf:Var,machine_type,eq,"tablet"
File:Run,"img %imgrestorecmd%%project_image_path%/tablet.zmg",verboseEnd:File:Run,"img %imgrestorecmd%%project_image_path%/%project_novcomp%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/%project_ztoolkit%",verboseFile:Run,"img %imgrestorecmd%%project_image_path%/%drivers_image%",verbosePause:2Dialog:Popupclose
; Update the information in ZISDZisd:Put,NetBiosName,%COMPUTERNAME%
; 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%")Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Owner","%valid_owner%")Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Owner_surname","%ldap_sn%")Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Owner_firstname","%ldap_givenName%")
ZISD:Put,VendorDataENGL,"%VendorDataENGLSTRING%"Zisd:Write; Trap ZISD:Write errorsIf:Var,_ERROR,ne,"0"
Dialog:Ask,"Error!","An error occurred writing information to ZISD!","_Ok",redEnd:
If:Var,AutoRestart,eq,"Yes"Goto:reboot
End:Menu:Return
Update information being written to ZISD
Copyright © Expert Networking Group Limited55
ScenarioSelecting owner of machine from AD using search filters
Note: The information used to configure the LDAP filtering can be customised to filter on whichever attribute you need to use, for some scenarios the surname, sAMAccountName or Display Name may be more appropriate to use.
If you require assistance in configuring forms to meet your needs contact us and we will be happy to assist.
Copyright © Expert Networking Group Limited56
DemoSelecting owner of machine from AD using search filters
Copyright © Expert Networking Group Limited57
ScenarioSelecting owner of machine from AD using search filters
Copyright © Expert Networking Group Limited58
Summary
Copyright © Expert Networking Group Limited59
Summary
The standard zim.cfg file can be modified and extended to ensure that Zim meets your requirements.
Copyright © Expert Networking Group Limited60
Issues
Copyright © Expert Networking Group Limited61
Issues
If you would like any more information or assistance with the procedures detailed in this TechBite let us know!
•Log an incident on englnet
https://englnet.engl.co.uk/nps
•Report an issue via support forum - engl.support.imagingtoolkit6.imaging
•Email [email protected]
Copyright © Expert Networking Group Limited62
More information
Copyright © Expert Networking Group Limited63
More Information
Useful links Product information and Downloads
www.engl.co.uk/products/imagingtoolkit
Success Stories
www.engl.co.uk/company/success
Partners
www.engl.co.uk/partners
Copyright © Expert Networking Group Limited64
More Information
Future Events Tech Bite sessions
Brainshare
www.engl.co.uk/events
www.engl.co.uk