*Update (Oct 2011) – Added known bug and workaround that is fairly important to know about (having code for applicationsXXX and then deselecting all through UI will not actually deselect)*

When using MDT 2010 through the LiteTouch deployment wizard, it can prove to be a pain when you remember how much you wish you could set values depending on what the user has clicked. This was one of the things that bothered me to no end. I have looked around, but there wasn’t quite the answer I was looking for.

First off, know that there are few things to clarify first. There are already well documented solutions for deployments on how to do this. Johan Arwidmark has  good article on this. The downside is this will not work on the wizard, as all ‘value sections’ are calculated ONLY when the wizard is first started. Secondly, there is a hack you may want to try, after a brief look, it looks simpler to implement which is a plus, however redoes the entire initialization. Not a bad approach, but I figured I could attempt to make it run without the redundancy. So far my code has held up through initial tests so I’m posting what I have so far here.

An Overview of How this Works


[Settings]
Priority=DynamicID, Default
Properties=DynamicTasks

[DynamicID]
DynamicTasks=WIN7_001,INSTALLPROGS

[Dynamic_INSTALLPROGS]
AreaCode=520
Applications1={2ef19b8a-b3c3-438a-91d6-b1162c2856ae}
Applications2={ed925194-4233-4029-a4f6-d9e2162d27a1}

[Dynamic_WIN7_001]
AreaCode=614

  1. First the code grabs the info from [DynamicID] as it would normally do, as it is treated like any other section provided in the Priority property.
  2. When parsing [DynamicID] the code would normally treat this as a literal value. However, my code will come into action when it detects a section named ‘DynamicID’. I hook into the code when this happens and it will look into DynamicTasks a special way.
  3. It runs through DynamicTasks, and will parse the values separated by commas.
  4. It then looks for sections Prefixed ‘Dynamic_’ that end with the above value. If found, it works through any properties, and keeps them in a pending list. After the prefix, I list the names of two task sequence IDs (INSTALLPROGS, and WIN7_001). The suffix, being the sequence ID, is what is used to determine which tasks to assign the new values to.
  5. Once the code senses TaskSequenceID changing, it checks to see if there are any variables bound to the ID, and overrides the original values.

Do note, unlike default behavior where some variables are set in stone upon first write, the custom code will force the value regardless. For variables in the form of lists (such as Applications1, Applications2, etc) that are being overridden, the entire array is wiped out, and set again — this is by design. So do not try to only have ‘Application9’ only thinking it will adjust just a single item. I believe at this time this behavior is the best of choices.

The Code Needed

ZTIGather.wsf (v1.0) (difference from MDT original)
ZTIUtility.vbs (v1.1 June 7 2011) (difference from MDT original)

Previous Versions:

ZTIUtility.vbs (v1.0) (difference from original)

The code contains modifications to two files within the MDT Scripts folder. One being ZTIGather.wsf and the other ZTIUtility.vbs. Any code changes I applied were surrounded with a comment beginning with MM: Mike Morawski. I would post the code inline here however it is a good sized page and has multiple insertion points (even though the code is in three general locations).

Be sure to update any boot images/CD’s being used (these files are pushed there when creating media!). The only case where a rebuild is not needed is if people are running litetouch via the network.

Known Bugs

  • Not so much a bug, just hasn’t been implemented: After selecting a task and defaults are overridden, if the back button is pressed, the defaults don’t come back. This can be worked around for now by declaring any values that may not come back in every grouping in customsettings.ini. Implementing this shouldn’t be hard at all if there is demand for such behavior.
  • (10/24/11) Deselecting ALL applications will not cause the Applications variable to be cleared the way the MDT code works (if it sees nothing selected, it leaves the variable alone, instead of clearing it out) if some apps were selected through code. Easy way around this is to create an invisible application that does nothing so something is always within the Applications variable. I found this workaround very easy so I left it like that rather than adjusting the code at this point in time.

Updates

  • (3/21/2011) – Added code. Added bug section.
  • (6/7/2011) – Code update to fix bug. Bug: Values would be changed properly according to task, however in task sequences with multiple gathers, if dynamic values were changed in wizard, they would go back to the dynamic values set in customsettings.ini. See Code section below for update. Version 1.1 uploaded.
  • (10/24/11) – Added known bug for ApplicationsXXX and simple workaround.

Comments 13

  • Very nice information and working like a charm!!!
    was looking for this for over 2 days now

    Thumbs up

  • Thank you very much. Worked fine for me.

    Keep up the good work.

  • Thanks! You saved my day with this fix.
    However I have one question to this aproach, can I still put variables in the default section to have them applied on all task sequences?
    Also you say that using the back button the defaults won’t come back, will this affect any predefined settings in the [default] sections?

  • You can still put variables in the default section, they work as they normally would.

    To elaborate a bit on your other question I’ll use an example. If you have Areacode=111 as a default, and you have a dynamic task with AreaCode=222. If the person goes into that task sequence related to the dynamic code, AreaCode gets changed from 111 to 222.

    Now all fine an dandy. HOWEVER, if the user goes all the way back to the start, and tries another task sequence, lets say this one has no dynamic settings and usually just runs off the default settings (where area code should be 111), the area code doesn’t get switched back to 111 from 222. This is the only thing I haven’t really coded in.

    So what I meant in the article under the ‘known bugs’, I state that if this is a problem, make AreaCode=111 in all the other sequences. This leads to redundancy, but I don’t think this script is worth my time/not popular enough to refine further to get rid of this workaround.

  • When I came across this article I was very excited to find a solution to what I wanted to accomplish but I’m having som problems and I’m not sure if your still offering assistance with this…I did as you suggested above but I’m gettinga script error which then causes everything to stop.

    Line: 424

    Char: 2

    Error: Object doesn’t support this property or method:
    ‘oUtility SelectSingleNodeStringEX’

    Code: 0

    URL:file//…./Scripts/Wizard.hta

    Any help would be appreciated

  • Hi Tom,

    Interesting, I don’t have the MDT server accessible at the moment, but that error does not appear to be related as I don’t see SelectSingleNodeStringEX anywhere in the two files I touch (unless I got rid of them, but I highly doubt that!)

    You’re not using MDT beta/2012 are you?

    If you swap back the originals, does everything work again?

  • Thanks for the reply Mike!

    No, I’m using MDT 2010 and Yes when I put the two originals back everything is back to normal.

    The only other customized thing I’m doing has to do with Unattend_PE_x86.xml explained in link below but I don’t see how the two relate.
    http://itbloggen.se/cs/blogs/micke/archive/2011/01/26/password-or-pin-code-protect-mdt-2010-litetouch.aspx

    I guess let me just recap what I did do…

    -Downloaded your 2 files ZTIGather.wsf and ZTIUtility.vbs
    -Backed up the originals and then replaced with your two
    -Edited my customsettings.ini
    [Settings]
    Priority=DynamicID, WizardMode, Default
    Properties=MyCustomProperty

    [DynamicID]
    DynamicTasks=CAPTUREBASE,BASE002

    [ADMIN]
    WizardSelectionProfile=AllTaskSequences

    [Default]
    _SMSTSOrgName=DISS Windows 7 Deployment
    WizardSelectionProfile=ApprovedTaskSequences
    OSInstall=YES
    SkipAdminPassword=YES
    SkipApplications=NO
    SkipBDDWelcome=YES
    SkipBitLocker=YES
    SkipComputerBackup=YES
    SkipLocaleSelection=YES
    KeyboardLocale=en-US
    SkipProductKey=YES
    SkipTaskSequence=NO
    SkipTimeZone=YES
    TimeZoneName=Eastern Standard Time
    SkipUserData=YES
    SkipSummary=YES
    SkipDomainMembership=NO
    SkipComputerName=NO

    [Dynamic_CAPTUREBASE]
    SkipCapture=NO
    SkipComputerName=YES
    SkipDomainMembership=YES
    JoinWorkGroup=WorkGroup

    [Dynamic_BASE002]
    SkipCapture=YES
    SkipComputerName=NO
    SkipDomainMembership=NO
    JoinDomain=EC

  • ^ I think the reason it is breaking is because its missing the DynamicTasks declaration (if that is what it is called).

    You List

    [Settings]
    Priority=DynamicID, WizardMode, Default
    Properties=MyCustomProperty

    [DynamicID]
    DynamicTasks=CAPTUREBASE,BASE002

    My code Lists

    [Settings]
    Priority=DynamicID, Default
    Properties=DynamicTasks

    [DynamicID]
    DynamicTasks=WIN7_001,INSTALLPROGS

    I think this is it.

  • I was so excited that, that was it but it was a no go. Same error.

    The error comes up right after I enter my credentials.

  • Hi Tom,

    I looked into the code, can’t find any idea on where this is being caused. Been awhile since I had to touch anything on my MDT server so I completely forgot — check the logs!

    C:\MININT\SMSOSD\OSDLOGS

    My code has lots of logging in it, so it should be easy to tell from there.

    You might want to try BDD.log, and just see if you see the code stopping near some of my logs (all of my log writes are prefixed with ‘MM:’)

  • I get the same error as Tom.

    Line: 424

    Char: 2

    Error: Object doesn’t support this property or method:
    ‘oUtility SelectSingleNodeStringEX’

    Code: 0

    URL:file//…./Scripts/Wizard.hta

    Looking at Mike’s ZTIGather.wsf script, it’s hard to see what has changed because it is an older version than the ZTIGather.wsf script that is in MDT 2012 Update 1. I did look though all the scripts and most of the XML file and could only find this entry in LTIApply.wsf and one other script, but I have forgotten which. Neither had anything at the line and character shown in the error. Not sure where to go from here except back to the original scripts.

  • I had forgotten to update my DS. After doing so and applying the new Boot image to WDS, the computer would loop boot. I changed the ZTIUtility.wsf back to the original and updated the DS again. This time it WinPE would boot, but it hangs on “Initializing”. I have a feeling it is because there is also a ZTIGatjher.xml file that was not changed.

    So I changed ZTIGather.wsf back to the original and updated the DS again. The only thing that I had changed from above would be the cs.ini. But, as expected, that didn’t matter.

    I’m setting applications to be pre-selected to install based on the TS chosen. The applications get installed, but they don’t show up as checked, well any applications listed under that TS in the cs.ini. MandatoryApplications listed by model and in the Default section are selected. I know there are ways around this by reprocessing the cs.ini file, but it adds several seconds of lag between screens; enough to start to wonder if you clicked “Next” or not. I’ll just have to keep looking.

  • Hi Mike,

    I wouldn’t trust this code outside of 2010. Quite a bit has changed in those files and my code wasn’t around when that came out (aside from the Beta, which I wasn’t catering to at the time).

    If I ever look into moving to 2012 I will see about creating an update.

    Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *