Overview
ZENworks imaging can be used to multicast images from either a server or a workstation. When multicasting images from a workstation Zim can be used to configure the session in a number of ways. Either multicasting all images from a master machine to identical machines, or multicasting all but the drivers and then unicasting the appropriate drivers image to different machine types or for restoring clone1 images to identical hardware.
For each scenario Zim will automatically configure the master machine prior to imaging, define an appropriate session name, name the target workstations and begin the imaging process.
1The Imaging Toolkit Zclonewiz utility can be used to create a clone image of a built machine for restoration to identical hardware.
Solution
Configure the Zim script to implement the three different multicast session types.
- Multicast to Identical Chipsets (The drivers image is included in the multicast session)
- Multicast to Different Chipsets (The drivers image is restored from the ZENworks server after the multicast session has completed)
- Clone image
Procedure
Done | Task | ||
---|---|---|---|
|
|||
|
|||
|
|||
|
-
Update the
zim.cfg
fileThe standard
zim.cfg
file must be updated in several places to implement multicasting.- Add a new "Multicast Menu" option by inserting a new submenu definition into the Main Menu definition as show in green below:
; Main Menu Menu:Start,mnu_main,"Main Menu","Blue" Menu:Submenu,mnu_restore,"Restore Menu","" Menu:Submenu,mnu_multi,"Multicast Menu","" Menu:Submenu,mnu_maint,"Maintenance Menu","" Menu:Separator ;Menu:Item,logout,"Logout" Menu:Item,reboot,"Reboot"
- Add the
Multicast Restore Menu
by inserting the lines in green between the end of the Restore Menu and the start of the Maintenance Menu as follows:
; Restore Menu Menu:Start,mnu_restore,"Restore Menu","Blue" ; 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 name Set:ProjectIndex,"1" Set:ProjectKey,"Project%ProjectIndex%" File:Ini,Get,"%_ZimDir%projects.ini","projects","%ProjectKey%",ProjectSection While:Var,ProjectSection,NE,"" ; Get project details File:Ini,Get,"%_ZimDir%projects.ini","%ProjectSection%","Description",ProjectDescription ; Add menu item Menu:Item,restore_ztoolkit_begin,"%ProjectDescription%","","%ProjectDescription%" ; Next project section Set:ProjectIndex,Math("+", 1) Set:ProjectKey,"Project%ProjectIndex%" File:Ini,Get,"%_ZimDir%projects.ini","projects","%ProjectKey%",ProjectSection Wend: ; Disable variable expansion in menu, item title and item params and after adding menu item Set:_MenuExpandTitleVariables,"false" Set:_MenuExpandItemParamsVariables,"false" Menu:Separator Menu:Item,_top,"Return to Main Menu" ; Multicast Menu Menu:Start,mnu_multi,"Multicast Menu","Green" Menu:SubMenu,multicast1,"Multicast to Identical Chipsets","","Drivers" Menu:SubMenu,multicast2,"Multicast to Different Chipsets","","No Drivers" Menu:Item,mc3,"Multicast Clone Image","","Clone" Menu:Separator Menu:Item,_top,"Return to Main Menu" Menu:Start,multicast1,"Multicast to Identical Chipsets","Green" ; Select project to multicast ; 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 name Set:ProjectIndex,"1" Set:ProjectKey,"Project%ProjectIndex%" File:Ini,Get,"%_ZimDir%projects.ini","projects","%ProjectKey%",ProjectSection While:Var,ProjectSection,NE,"" ; Get project details File:Ini,Get,"%_ZimDir%projects.ini","%ProjectSection%","Description",ProjectDescription ; Add menu item Menu:Item,mc1,"%ProjectDescription%","","%ProjectDescription%" ; Next project section Set:ProjectIndex,Math("+", 1) Set:ProjectKey,"Project%ProjectIndex%" File:Ini,Get,"%_ZimDir%projects.ini","projects","%ProjectKey%",ProjectSection Wend: ; Disable variable expansion in menu, item title and item params and after adding menu item Set:_MenuExpandTitleVariables,"false" Set:_MenuExpandItemParamsVariables,"false" Menu:Separator Menu:Item,_previous,"Return to previous Menu" Menu:Start,multicast2,"Multicast to Different Chipsets","Green" ; Select project to multicast ; 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 name Set:ProjectIndex,"1" Set:ProjectKey,"Project%ProjectIndex%" File:Ini,Get,"%_ZimDir%projects.ini","projects","%ProjectKey%",ProjectSection While:Var,ProjectSection,NE,"" ; Get project details File:Ini,Get,"%_ZimDir%projects.ini","%ProjectSection%","Description",ProjectDescription ; Add menu item Menu:Item,mc2,"%ProjectDescription%","","%ProjectDescription%" ; Next project section Set:ProjectIndex,Math("+", 1) Set:ProjectKey,"Project%ProjectIndex%" File:Ini,Get,"%_ZimDir%projects.ini","projects","%ProjectKey%",ProjectSection Wend: ; Disable variable expansion in menu, item title and item params and after adding menu item Set:_MenuExpandTitleVariables,"False" Set:_MenuExpandItemParamsVariables,"False" Menu:Separator Menu:Item,_previous,"Return to previous Menu" ; Maintenance Menu Menu:Start,mnu_maint,"Maintenance Menu","Red" Menu:Separator
- Add a Multicast Section between the Restore ENGL Smart Windows Deployment images and Maintenance Menu Tasks sections of the zim.cfg file by inserting the lines in green as follows
Set:MonitorStatus,"Finished" Gosub:SendUpdateToMonitorServer If:Var,AutoRestart,EQ,"Yes" Goto:reboot End: Menu:Return ;-------------------------------------------------------------------------------- ; Multicast ;-------------------------------------------------------------------------------- Label:mc1 Set:Mcast_Drivers,"Yes" Set:Mcast_session_default,"%drivers_image%" Set:lookup_project,"%_ITEMPARAMS%" Goto:Multicast Label:mc2 Set:Mcast_Drivers,"No" Set:Mcast_session_default,"ENGL" Set:lookup_project,"%_ITEMPARAMS%" Goto:Multicast Label:mc3 Set:Mcast_Drivers,"" Set:Mcast_session_default,"ENGLClone" Set:lookup_project,"ENGLClone" Set:Clone_Session,"True" Goto:Multicast Label:Multicast ; Configure computername for multicast sessions ; Check for an AssetTag we can use for the DMI_NAME Set: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_COMPUTERNAME If:Var,ZISD_COMPUTERNAME,NE,"" Set:COMPUTERNAME,"%ZISD_COMPUTERNAME%" Else: Set:COMPUTERNAME,"%DMI_NAME%" End: ; Identify project related settings: ; Check hardware was found in lookup file If:Var,drivers_image,EQ,"" Dialog:Ask,"","This machine type was not found in the lookup file.","_Ok","Red" Goto:Menu_Display End: Set:mcast_type,"Client" Set:mcast_autorestart,"Yes" Label:Multicast_Session_Info ; Prompt for multicast session information Form:Start,"Multicast","Select Multicast options","_BackNextCancel^_Next","Green" Form:Item,"Item1",Label,"Select Multicast Option" Form:Item,"Item2",Radiobuttons,"%mcast_type%","Master,Client" Form:Item,"Item3",Label,"Session Name " Form:Item,"Item4",EditBox,"%Mcast_session_default%" If:Var,lookup_project,EQ,"" Form:Item,"proj1",Label,"Select Project (for drivers)" Form:Item,"proj2",ListBox_File,"%zisd_project%","%_ZimDir%/projects.ini","projects","=",2 End: Form:Item,"Item5",Label,"Computer Name" Form:Item,"Item6",EditBox,"%COMPUTERNAME%" Form:Item,"Item7",Label, "Auto Restart after imaging" Form:Item,"Item8",Radiobuttons,"%mcast_autorestart%","Yes,No" Form:Item,"Item9",StaticText,"Continue?" ; Display form Form:Display,"Multicast" Set:mcast_type,"%_Multicast_item2%" Set:mcast_session_name,"%_Multicast_item4%" Set:Ask_COMPUTERNAME,"%_Multicast_item6%" Set:mcast_autorestart,"%_Multicast_item8%" If:Var,lookup_project,EQ,"" Set:lookup_project,"%_Multicast_proj2%" End: Set:mcast_form,"%_form%" If:Var,mcast_form,EQ,"_Back" Menu:Return End: If:Var,mcast_form,EQ,"_Cancel" Goto:Menu_Display End: If:Var,Ask_COMPUTERNAME,NE,"%COMPUTERNAME%" Set:COMPUTERNAME,"%Ask_COMPUTERNAME%" End: If:Var,Ask_COMPUTERNAME,EQ,"" Dialog:Ask,"","You must specify a Computer Name.","_Ok",Red Goto:Multicast_Session_Info Else: Set:ComputerNameLength,Len(%Ask_COMPUTERNAME%) If:Var,ComputerNameLength,GT,"15" Dialog:ask,"Error","You must specify a Computer Name less than 16 characters","_Ok",red Goto:Multicast_Session_Info End: End: If:Var,Ask_COMPUTERNAME,CONTAINS," " Dialog:Ask,"","The Computer Name must not contain a space.","_Ok","Red" Goto:Multicast_Session_Info End: Label:lookup_mcast_project_info If:Var,Clone_Session,NE,"True" ; Read in project specific information File:Ini,Get,"%_ZimDir%projects.ini","%lookup_project%","project_image_path",project_image_path File:Ini,Get,"%_ZimDir%projects.ini","%lookup_project%","project_os",project_os File:Ini,Get,"%_ZimDir%projects.ini","%lookup_project%","partition_count",partition_count File:Ini,Get,"%_ZimDir%projects.ini","%lookup_project%","driver_os",project_driver_os File:Ini,Get,"%_ZimDir%projects.ini","%lookup_project%","base_image",base_image File:Ini,Get,"%_ZimDir%projects.ini","%lookup_project%","ztoolkit",project_ztoolkit File:Ini,Get,"%_ZimDir%projects.ini","%lookup_project%","novcomp",project_novcomp If:Var,partition_count,EQ,"1" Set:project_partition,"" Else: Set:project_partition,"-ap=a1:p2" End: ; Check to see if Hardware driver is available for project_os If:Var,driver_os,CONTAINS,"%project_driver_os%" ; Hardware driver is available for this project Goto:ztoolkit_mcast_computername Else: ; Hardware driver is not available for this project Form:Start,"os_available","hardware image not found","_Ok","Blue" Form:Item,"Item1",StaticText,"-The driver image for the selected Operating System" Form:Item,"Item2",StaticText,"-has not been found." Form:Item,"Item3",StaticText,"-Check the entry for this machine in the images.ini." Form:Item,"Item4",Label,"Selected OS" Form:Item,"Item5",EditBox,"%project_driver_os%",ReadOnly Form:Item,"Item6",Label,"Available OS" Form:Item,"Item7",EditBox,"%driver_os%",ReadOnly Form:Item,"Item8",Label,"Hardware Image" Form:Item,"Item9",EditBox,"%drivers_image%",ReadOnly Form:Item,"Item10",StaticText,"-Select OK to return to the Menu" Form:Display,"os_available" Menu:Return End: End: Label:ztoolkit_mcast_computername If:Var,mcast_form,EQ,"_Next" If:Var,mcast_type,EQ,Master Goto:Multicast_Master Else: Goto:Multicast_Client End: End: Label:Multicast_Master ; Launch a form to display detected hardware and select machine type Form:Start,"Multicast_Master","Multicast Master","_BackNextCancel^_Next","Yellow" If:Var,Clone_Session,NE,"True" 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 Else: Form:Item,"Clone1",Label,"Select Clone Image" Form:Item,"Clone2",ListBox_File,"","%_ZimDir%/clones.ini","Clones","=",2 End: Form:Item,"Item11",Label,"Clients to wait for" Form:Item,"Item12",EditBox,"30" Form:Item,"Item13",Label,"Wait time (minutes)" Form:Item,"Item14",EditBox,"30" ; Display form Form:Display,"Multicast_Master" If:Var,_Form,EQ,"_Cancel" Goto:Menu_Display End: If:Var,_Form,EQ,"_Back" Goto:Multicast_Session_Info End: Set:mcast_master_clients,"%_Multicast_Master_Item12%" Set:mcast_master_time,"%_Multicast_Master_Item14%" If:Var,Clone_Session,EQ,"True" Set:lookup_project,"%_Multicast_Master_clone2%" File:Ini,Get,"%_ZimDir%clones.ini","%lookup_project%","clone_image",clone_image File:Ini,Get,"%_ZimDir%clones.ini","%lookup_project%","clone_os",project_os File:Ini,Get,"%_ZimDir%clones.ini","%lookup_project%","clone_image_path",clone_image_path End: Label:restore_mcast_master_begin Dialog:Ask,"", "Warning! All hard disk data on this machine will be erased.\n\nContinue?","_YesNo^_Yes","Red" If:Var,_ask,EQ,"_No" Goto:Menu_Display End: Dialog:Popup,"Restoring project images \n\n (%lookup_project%)\n\n Please Wait...","Green" Pause:3 ; Update VendorDataENGL (sample) Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Machine_Type","%machine_type%") Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","OS","%project_os%") Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Project","Multicast Master - %lookup_project%") Set:MonitorStatus,"Started" Gosub:SendUpdateToMonitorServer If:Var,Clone_Session,NE,"True" File:Run,"img %imgrestorecmd%os/%project_os%/%base_image%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose File:Run,"img %imgrestorecmd%projects/%project_image_path%/hotfixes.zmg %project_partition%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose If:Var,machine_type,EQ,"tablet" File:Run,"img %imgrestorecmd%os/%project_os%/tablet.zmg %project_partition%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose End: File:Run,"img %imgrestorecmd%projects/%project_image_path%/%project_novcomp% %project_partition%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose File:Run,"img %imgrestorecmd%projects/%project_image_path%/%project_ztoolkit% %project_partition%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose If:Var,Mcast_Drivers,EQ,"Yes" File:Run,"img %imgrestorecmd%drivers/%project_driver_os%/%drivers_image% %project_partition%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose End: Else: File:Run,"img %imgrestorecmd%%clone_image_path%/%clone_image%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose End: Pause:2 Dialog:Popupclose ; Now run the Multicast Master session File:Run,"img session %mcast_session_name% master client=%mcast_master_clients% time=%mcast_master_time%",verbose If:Var,_error,EQ,189 ; Multicast session was aborted File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose dialog:ask,"Warning","Multicast Master session was aborted. Return to Main Menu","_Ok",Red Goto:Menu_Display End: ; Capture the img session imglogr information File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose Label:Multicast_Client If:Var,mcast_type,EQ,"Client" Dialog:Ask,"", "Warning! All hard disk data on this machine will be erased.\n \nContinue?","_YesNo^_Yes","Red" If:Var,_ask,EQ,"_No" Goto:Menu_Display End: ; Session is a multicast client Set:Session_Type,"Multi-Client" ; Update VendorDataENGL (sample) Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Machine_Type","%machine_type%") Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","OS","%project_os%") Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Project","Multicast Client - %mcast_session_name%") Set:MonitorStatus,"Started" Gosub:SendUpdateToMonitorServer File:Run,"img session %mcast_session_name% client",verbose If:Var,_error,EQ,189 ; Multicast session was aborted File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose dialog:ask,"Warning","Multicast Client session was aborted. Return to Main Menu","_Ok",Red Goto:Menu_Display End: ; Capture the img session imglogr information File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose End: ; Restore drivers from the server (unicast the drivers after multicast session has completed) If:Var,Mcast_Drivers,EQ,"No" File:Run,"img %imgrestorecmd%drivers/%project_driver_os%/%drivers_image% %project_partition%",verbose File:Run,"cat imglogr >> %_ZimDir%zim.log",verbose End: ; Update the information in ZISD Label:Mcast_ZISD_CHECK ; Update the information in ZISD Zisd:Put,NetBiosName,"%COMPUTERNAME%" ZISD:Put,VendorDataENGL,"%VendorDataENGLSTRING%" Set:zisd_update_count,"1" Label:update_zisd ZISD:Write ; Trap ZISD:Write errors If:Var,_ERROR,ne,"0" If:Var,zisd_update_count,LT,"3" Set:zisd_update_count,math(+, 1) File:Run,"dd if=/dev/zero of=/dev/%HDTYPE% bs=512 seek=5 count=3",silent Goto:update_zisd Else: Dialog:Ask,"Error!","An error occurred writing information to ZISD!","_Ok","Red" End: End: Set:MonitorStatus,"Finished" Gosub:SendUpdateToMonitorServer If:Var,mcast_autorestart,EQ,"Yes" Goto:reboot End: Goto:Menu_Display ; ------------------------------------------------------ ; Maintenance Menu Tasks ; ------------------------------------------------------ ; Clear ZENworks Image-safe Data Label:maint_clear_zisd
- Save the changes to the
zim.cfg
file.
- Add a new "Multicast Menu" option by inserting a new submenu definition into the Main Menu definition as show in green below:
-
Create a clones lookup file
A
clones.ini
lookup file is required to tell Zim where and what clone image file should be restored.
If you do not use clone images then this step can be skipped.
This file has two sections. The top section lists the available clone images. The bottom section contains the details on the image file, location and OS.
For example:; ENGL Zim clone.ini lookup file [clones] image = Thinkpad t61p (Win8x64) image = Dell E4300 (Win7x86) [Thinkpad t61p (Win8x64)] clone_image = thinkpadt61-w8x64 clone_os = win8-pro-x64 clone_image_path = clones [Dell E4300 (Win7x86)] clone_image = latitude-e4300-clone-w7 clone_os = win7-sp1-pro-x86 clone_image_path = clones
Ensure that the appropriate image files are in the relevant folder. For this example the content-repo/images structure should look like this:
content-repo | \---images | +---clones | latitude-e4300-clone-w7.zmg | thinkpadt61-w8x64.zmg | +---drivers | +---os | \---projects
-
Update zimget.s
The
tftp\zimfiles\zimget.s
file is used to TFTP files from the ZENworks server into the ZENworks imaging environment. If you have created aclones.ini
file then thezimget.s
file needs to be updated to ensure that the clones.ini file is available when Zim runs
Update thezimget.s
file by inserting the lines in green as follows... ... 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/clones.ini $ZIMDIR/clones.ini quit _END_ ... ...
-
Test updated files
PXE boot a machine to the ZENworks imaging environment. Zim will load as normal but there will now be a Multicast Menu.
This menu gives the three multicast options, selecting one of these will start the image restoration and multicast process and the machines will build as required.
Menu item Image selection Description Multicast to Identical Chipsets Select a project from the same list as used by the Restore Menu With this option the drivers image is included in the multicast session and will only work with identical hardware. Multicast to Different Chipsets Select a project from the same list as used by the Restore Menu With this option the drivers image is restored from the ZENworks server after the multicast session has completed. This allows the multicast to be sent to differing hardware types. Clone image Select an image from the clone lookup file With this option the clone lookup file is used to list the image to restore to the master machine then multicast out to the identical clients.
If you have any problems or questions about the script or steps in this TID please contact the ENGL support team