2 Replies Latest reply on Oct 5, 2015 9:09 AM by MikeForg

    Template - using Powershell to alter unattend.xml

    MikeForg Apprentice

      Hi guys,


      I'm working in an international environment, thus I would like to automate the different regional settings during the installation process.


      I can determine the language setting by the IP address, as each country has a specific IP range.


      I made up a Powershell script that fills variables according to the IP range :


      # This scripts assigns the regional settings according to the current IP address range

      # Find local IP address

      $localIpAddress=((ipconfig | findstr [0-9].\.)[0]).Split()[-1]

      if ($localIpAddress -match "10.90") {$OSDInputLocale="040c:0000040c";$OSDSystemLocale="fr-FR";$OSDUserLocale="fr-FR";$OSDTimeZone="Romance Standard Time"}

      # French settings

      elseif ($localIpAddress -match "10.80.") {$OSDInputLocale="DE-de";$OSDSystemLocale="DE-de";$OSDUserLocale="DE-de";$OSDTimeZone="W. Europe Standard Time"}

      # German settings

      else {$OSDInputLocale="0409:00000409";$OSDSystemLocale="en-US";$OSDUserLocale="en-US";$OSDTimeZone="Eastern Standard Time"}

      # US settings - these are the default settings if the IP range is not defined above


      The script works fine. But now the question :


      How do I get the variables in the unattend.xml during the provisioning process ? Do I have to run the script in the template or do I have to call it in the unattend.xml ?


      In my unattend.xml I put the following :

      - <settings pass="oobeSystem">


      - <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">












      Is this correct ?



      Thanks for your input !



        • 1. Re: Template - using Powershell to alter unattend.xml
          Tanner Lindsay SupportEmployee


          With what you have outlined here, one option to get the values into the unattend file would be just have the powershell script do the substitution in the XML. While LANDESK does handle variables and can do the "substitution", it doesn't work conditionally. You could use a value from the inventory of the device, or a static value, but you can't use one value from the inventory (IP address) to then put a different value in for the variable.


          However, variables can also be created at several levels. You can create public variables, which apply to everything, or template variables that override any public variables for a specific template. You can also create Computer variables that are specific to devices. However, it won't do exactly what you are looking for.

          • 2. Re: Template - using Powershell to alter unattend.xml
            MikeForg Apprentice

            Hi Tanner,


            thanks for your answer.


            In the meantime I wrote a VBscript that in function of the detected IP address firstly creates a reg file and than imports it in the configuration phase of the template.


            This way I can change the keyboard layout, currency and timezone settings.