Dynamically select OS Image in the MDT Lite Touch Task Sequence

Earlier this week I got a question on how to have a single MDT Lite Touch task sequence support a dynamic selection of OS Image.

Now, typically I recommend having a 1:1 relationship between task sequence and OS Image, but you can certainly have MDT dynamically pick an OS Image based on a variable you define in CustomSettings.ini. It just requires a little trick  🙂

Scenario

In this scenario I'm setting a custom variable named CustomImageVariable to dynamically select an OS Image.

This means I have multiple Install Operating System actions in my task sequence, each of them with a condition. For example CustomImageVariable=1607 (see below).

image
An Install Operating System action configured with a condition.

The tricks

If you only do the above configuration, MDT will select the first OS Image that is configured with the task sequence. This is done even before the Install Operating System is run, so to force MDT use the image you want, you need to clear the OSGUID variable before the various Install Operating System actions. Here is how:

image
Adding a Set Task Sequence Variable action to clear the OSGUID variable.

CustomSettings.ini

Finally you need to have your CustomSettings.ini file dynamically set the CustomImageVariable variable. Here is an example with CustomSettings.ini being configured to set it differently depending on default gateway (network).

[Settings] 
Priority=DefaultGateWay, Default 
Properties=CustomImageVariable

[DefaultGateWay] 
192.168.10.1=Oslo 
192.168.20.1=Stockholm

[Oslo] 
CustomImageVariable=1607

[Stockholm] 
CustomImageVariable=1703

[Default] 
OSInstall=YES

Written by Johan Arwidmark

About the author

Johan Arwidmark

5 2 votes
Article Rating
Subscribe
Notify of
guest
15 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Trong Tinh
Trong Tinh
8 days ago

Hi, Can I use Dynamic OS Image based Total Control

Dan
Dan
1 year ago

Wonderful Article. Thanks. to stray a little bit, I'd like to be able to have the user prompted at run-time. Issue, I need to make these into deployable media. It seems there HAS to be a way to add a wizard pane with a set of radio buttons or dropdown list. Currently the media has a limited set of Task Sequences to choose from, but I need to be able to support the same set of TSes on top of multiple versions of windows, depending on the … uh "department". All the different 'departments' are 'silos' that use exactly the… Read more »

choypogi07
choypogi07
3 years ago

Hello Johan.. I've just come into this article of yours, and I would like to think that its what I need, or somewhere close to it. Basically when I run my TS, I need the user to indicate the PC Name, and then choose a TS to deploy (could be vice versa). I have several TS that has different applications depending on the location of where the laptop will be used in.

Herry Nguyen
Herry Nguyen
3 years ago

Hi, I want use task sequence id and get osdcomputername for sequence id that but error. You can help me customsetting.ini?

dcletech
dcletech
3 years ago

Hi Johan. Would this solution work with an MDT Integrated SCCM Task Sequence? I know it is an older blog post but seems to fit my situation. Essentially, I am trying to reduce down the number of Win10 task sequences we have in our environment. I have a PowerShell GUI tool launched at the beginning of our MDT integrated task sequences so that our techs can set a few variables based on certain criteria they select (e.g. what apps to install). In the GUI I am looking to add the selection of what Custom Image the tech needs to deploy… Read more »

anon
anon
3 years ago

Ehh, sorry just wanted to quickly chime in that my Windows 7 OS had its autoattend xml missing. more specifically, the new autoattend i generated for it was basically blank and didn't have much instruction for it to use so essentially if the autoattend xml is faulty, the error i described will appear for anyone searching for an answer.

anon
anon
3 years ago

Hey one more thing, I had an issue where the windows 7 deployment could not proceed due to the task sequence's autoattend.xml being linked to Windows 10. How do we dynamically link an autoattend.xml for Windows 7 or other variants of Windows as well? Thanks in advance!

anon-fromYesterday
anon-fromYesterday
3 years ago

Hey, me again. Yeah, posted a bit too soon yesterday… Any advice on how to merge the two? I was trying to have 1 single custom UDI interface for lite touch deployment. Any way to say, when user selects dropdown as 'windows 7' to load the older windows 7 task sequence instead? We're going to be phasing it out soon anyways, just sort of bugs me that I can't streamline now in the event a win7 installation is needed. Any advice? Any way to set a variable that specifies with unattend.xml file to use and override the one associated with… Read more »

anon
anon
3 years ago

THANK YOU!!!


>