User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

I'm sure you have seen Steve Thompson's blog showing how ENGL Imaging Toolkit 10.0.2 can help tidy up the Windows Start Menu.

This blog will take the process a step further and show you how you can use PowerShell and Imaging Toolkit 10.0.2 to control what appears on the Windows 10 start menu.

Our scenario for this blog is that we want to select which apps are displayed on the start menu from the Zim menu at the point of imaging.

 

Identify Apps

First of all we need to know which applications are installed in our standard build, so from a machine built using an Imaging Toolkit proect, launch the powershell console then type:

 Get-StartApps


The output displays the Start menu application name and it's corresponding appID, we only need the application name at this point so can run the command:

 Get-StartApps | Select-Object name

 

Select Apps in Zim

We can then select the applications that we might want to display on the Start menu and create a list which can be displayed on a Zim form.

There are several changes to the zim.cfg file required, these are highlighted in green below. A sample zim.cfg file is in the zip file attached at the bottom of the page for reference.

  1. Read in information stored in ZENworks Image-Safe Data (ZISD)
    ; Get network info 
    Network:Get,eth0,IPADDR,Network_IP 
    Network:Get,eth0,NETMASK,Network_Mask 
    Network:Get,eth0,HWADDR,Network_Mac 
    
    ; Read ZISD:VendorDataENGL 
    ZISD:Get,VendorDataENGL,VendorDataENGLSTRING 
    
    ; Read stored information in from VendorDataENGL 
    Set:Zisd_Project,GetKeyPairStringValue("%VendorDataENGLSTRING%", "Project") 
    
    ; *** Start Menu Blog *** 
    ; Read StartMenu Apps List in from ZISD 
    Set:Zisd_apps,GetKeyPairStringValue("%VendorDataENGLSTRING%", "Apps")
    ; *** Start Menu Blog ***
  2. Create a list of applications and modify the Zim form to display the list as a series of checkboxes
    Label:Ztoolkit_ComputerName_Form 
    
    ; *** Start Menu Blog *** 
    Set:Applist,"Mozilla Firefox,Mozilla Thunderbird,FileZilla,VLC media player,Skype,LibreOffice Calc,LibreOffice Math,LibreOffice Writer,GIMP 2,Google Earth,Notepad++,ZENworks Application Window,PDFCreator,PuTTY,WinSCP"" 
    ; *** Start Menu Blog *** 
    
    ; 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%" 
    ; *** Start Menu Blog *** 
    Form:Item,"apps1",Label,"Select Start Menu Apps" 
    Form:Item,"apps2",CheckBoxes,%ZISD_APPS%,"%Applist%" 
    ; *** Start Menu Blog *** 
    Form:Item,"Item13",Label,"Auto Restart after imaging" 
    Form:Item,"Item14",RadioButtons,"Yes","Yes,No" 
    Form:Display,"Info" 
    
    If:Var,_Form,EQ,"_Cancel" 
      Menu:Return 
    End: 
    Set:Ask_COMPUTERNAME,"%_Info_item12%" 
    Set:AutoRestart,"%_Info_item14%" 
    ; *** Start Menu Blog *** 
    Set:lookup_apps,"%_Info_apps2%" 
    ; *** Start Menu Blog ***
  3. Store the list of selected applications to ZISD
     Dialog:Popup,"Restoring ENGL Smart Windows build process, 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","%Lookup_Project%") 
     
     ; *** Start Menu Blog *** 
    Set:VendorDataENGLSTRING,PutKeyPairStringValue("%VendorDataENGLSTRING%","Apps","%lookup_apps%") 
     ; *** Start Menu Blog *** 

We can now display a form that lists the applications you would like to see on the start menu, the list will be stored in ZISD so that we can use it during the Imaging Toolkit build process.

 

Configuring the Start Menu

We now have a list of applications that we'd like to display, so the next step is to configure Windows 10 to display our applications rather than the default set.

Windows 10 includes several features that we will use:

  • Group Policy to control the Start menu
  • PowerShell Method to export the current Start menu layout
  • PowerShell Method to manipulate XML files

Imaging Toolkit 10.0.2 includes ZtoolkitCtrl PowerShell methods. These will be combined into a phase3-after.ps1 script that can be used during the build process.

Export the Current Start menu layout.

The Default Start menu will look like this:

The PowerShell function "Export-StartLayout" will export the current start menu layout.

Open the PowerShell Console then run:

 Export-StartLayout -Path "C:\engl\StartMenu.xml"


This will produce a StartMenu.XML file for the current layout:

We want to modify this layout to display the applications we have selected. The phase3-after.ps1 script included in the attached zip will perform the following tasks:

  1. Extract the list of applications we stored in ZISD
  2. Export the current Start menu layout toC:\ENGL\StartMenu.xml
  3. Create an 'ENGL APPS' group and populate that group with the list of applications read from ZISD
  4. Remove the two default Microsoft groups, this will remove Edge and Cortana from the Start menu.
  5. Save the modified StartMenu.xml file

The updated StartMenu.xml file will now contain our selected applications:

Using Group Policy to Control the start Menu.

Once we have the Start menu layout file we can use Windows 10 Group policy "Start Layout" optionto apply the layout. The policy setting can be delivered by a registry edit, ZENworks policy or AD Group Policy, in this case we will set the following registry key directly in the phase3-after.ps1 script

HKLM:\Software\Policies\Microsoft\Windows\Explorer\StartLayoutFile

We will also lock the Start menu layout by setting the following value to 1:

HKLM:\Software\Policies\Microsoft\Windows\Explorer\LockedStartLayout

Adding the script file to the Project

The phase3-after.ps1 script file will need to be added into our Windows 10 project.

  1. Open the project in Build Console
  2. Select Expert View
  3. Select Customisation > Custom Files
  4. Right click in the Properties box and select Add
  5. Browse to the phase3-after.ps1 file and click OK

The script file will now be included in the Build Process image and will run automatically at the end of phase3 of the deployment process.

Recreate the Build Process image (ztoolkit)

  1. Launch the Deployment Wizard
  2. Select the option to create Build Process images
  3. Select the option to create the Build Process (ztoolkit) image
  4. Once complete, copy the new Ztoolkit image to the server

Deploy the project to a Windows 10 Machine

Deploy the project to a suitable machine and make a note of the applications you select from the imaging menu:

Once the deployment process has completed, log in and review the Start menu.

 

Additional options

This blog covers one scenario and start menu layout. There are a number of options available to you for the menu layout such as making the Start menu full screen, changing the number of columns or the tile size, configuring multiple groups etc.

 

Files for download

customwin10startmenu.zip