locked
MDT 2013 and RES Automation Manager RRS feed

  • Question

  • Hi,

    In one of the first step of MDT I'm using a simple script that asks for the country code (e.g. NL), which I would like to store in an environment variable, which I can later on read into RES Automation Manager. But it seems that after MDT is finished and Windows starts up, the environment variable is gone.  Are there any other ways to accomplish this? I'm using it to install language specific applications from RES AM, after MDT is finished. The Windows language settings itself I set with the CustomSettings.ini, that is based on the same simple script

    [Settings]
    Priority=ByCountry, CountryAbbr,Model,Default
    Properties=CountryAbbr, CountryOU,CustomProperty
    
    [ByCountry]
    UserExit=ZTIGetCountry.vbs
    CountryAbbr=#GetCountryCode()#
    
    [NL]
    CountryOU=NL
    CountryOrRegion=31
    InputLocale=0409:00020409
    KeyboardLocale=nl-US
    UserLocale=nl-NL
    UILanguage=nl-NL
    TimeZoneName=W. Europe Standard Time

    ZTIGetCountryCode.vbs

    Function UserExit(sType, sWhen, sDetail, bSkip) 
                    oLogging.CreateEntry "entered UserExit ", LogTypeInfo 
                    UserExit = Success 
    End Function
     
    Function GetCountryCode() 	
    	Set objShell = CreateObject("WScript.Shell")
    	Set objEnv = objShell.Environment("SYSTEM")
    	
    	GetCountryCode = InputBox("Fill in Country Code (NL DE DA FR PT); If default, use None")
    	
    	objEnv("MDT_Language") = GetCountryCode
    	
    	Set objShell = Nothing
    	Set objEnv = Nothing
    End Function

    Any idea what I can do else??

    Thanks,

    Mario

    Friday, December 19, 2014 1:00 PM

Answers

  • Is this a NewComputer scenario? If so, you are running the script within WinPE, and any modifications to the "System" environment will be reflected in WinPE, and thus *LOST* when rebooted. *THAT* is the reason why there exists the MDT Environment variables, they are persisted across reboots.

    So...

    When calling your application installation... I would use the CountryAbbr variable which is already available:

    InstallPackage.exe /q /LanguageAbbr=%CountryAbbr%

    -k


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Tuesday, December 23, 2014 4:45 AM

All replies

  • Hi, this looks quite similar to my blog post I did some time ago:

    MDT 2012 LTI Deployment, Regional and Locale settings based on #chars of Hostname

    The trick in your specific case is to either, not reboot your machine, or to set the installation of RES Automation Manager right after the reboot.

    Basically MDT clean's up it's act after it is finished. This also means the environment variables which are stored in a .dat file in the C:\MININT folder are removed after MDT has finished.

    So either you need to find a way to perform your RES AM job, during the MDT task sequence, or set or dump the environment variables to a file are temporarily variable which RES AM can use.

    Here are some articles that will help you get further:

    MDT and RES Automation Manager – Let’s come together (in Sweet Harmony)

    Creating custom variables in MDT 2013

    Finding All References to MDT Variables in a Deployment Share: VariableDocumentor v1.0

    Dumping Task Sequence Variables

    Cheers!


    If this post is helpful please click "Mark for answer", thanks! Kind regards


    Friday, December 19, 2014 1:24 PM
  • So either you need to find a way to perform your RES AM job, during the MDT task sequence, or set or dump the environment variables to a file are temporarily variable which RES AM can use.

    RES AM agent is being installed during the TS which the /Invoke option that starts up a project in RES AM (which installs the various software) and yes, there's a reboot somewhere before I believe. You mentioned I could also place a file, that will also do it for me, as I can read out a file also as a condition. Where should I place the file then (I ask for the language setting before formatting/installing).

    Friday, December 19, 2014 1:46 PM
  • I have a registry key under hklm\software\mycorp where I keep asset information, you could do something like that, write it to there and read it later
    Friday, December 19, 2014 5:03 PM
  • Already tried that one, but seems that the keep is cleaned up
    Saturday, December 20, 2014 9:59 AM
  • 1. I'd suggest you build a custom Wizard Dialog box to capture the custom text (Country Code), use the MDT Studio to do so.

    2. Populate the information into a custom Environment Variable.  Then you will be able to access it anytime you need.


    -BrianG (http://supportishere.com)

    Sunday, December 21, 2014 3:04 AM
  • Is this a NewComputer scenario? If so, you are running the script within WinPE, and any modifications to the "System" environment will be reflected in WinPE, and thus *LOST* when rebooted. *THAT* is the reason why there exists the MDT Environment variables, they are persisted across reboots.

    So...

    When calling your application installation... I would use the CountryAbbr variable which is already available:

    InstallPackage.exe /q /LanguageAbbr=%CountryAbbr%

    -k


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Tuesday, December 23, 2014 4:45 AM
  • Ok, finally got it! Indeed I can use CountryAbbr, which I defined in an earlier stage and in the last bit of the TS I set an environment variable with the help of a wsf script described here:

    http://blogs.technet.com/b/deploymentguys/archive/2011/08/03/setting-environment-variables-in-a-task-sequence.aspx

    Thank you all for helping me out.....

    Monday, December 29, 2014 2:14 PM