r/MDT • • Mar 05 '20

DefaultGateway variable in Task Sequence

Hello friends,

I just finished the setup of MDT/WDS in our org and I am really excited to play further with it. Now for next step I want to implement it across multiple sites. And one of the wall I hit is with the application install based on location, is there any way to use DefaultGateway value in TaskSequence step "options" so it installs a particular app for particular site.I was actually able to achieve this using customsettings.ini and defining the apps there as mandatory apps, see below:

[Settings]
Priority=DefaultGateway, NY, SFO, Default

[DefaultGateway]
172.16.203.254=NY
10.30.1.1=SFO

[NY]
MachineObjectOU=OU=NY Workstations,OU=Computers,<redacted>
; ESET NY
;MandatoryApplications001={80a3773d-6579-4e0c-a96f-29c7e4a020ca}


[SFO]
MachineObjectOU=OU=SFO Workstations,OU=Computers,<redacted>
; ESET SFO
;MandatoryApplications001={80a3773d-6579-4e0c-a96f-29f34jkerwa}

[Default]
<redacted>

; Slack
MandatoryApplications001={23a6b7fa-f1b9-47c2-b83e-b46b3b9cb6be}
; Firefox
MandatoryApplications002={a8444ef9-c4b3-4c62-b15f-a193900b4304}
; Edge
MandatoryApplications003={6e40905b-8bea-4134-bc77-37f34f135ecd}

However the issue with this is that it install ESET as the very first app and ideally I would like this to be as last step in Task Sequence.So I have two questions:

  1. Is it possible to use DefaultGateway value in TaskSequence Step options, if so what is the "Task Sequence Variable" name for that? Because "DefautGateway" does not work

  2. Is it possible to assign two values to a default gateway and then use those separately to perform tasks, e.g:

[Settings]
Priority=DefaultGateway, NY-OU, SFO-OU, Default, NY-APP, SFO-APP

[DefaultGateway]
172.16.203.254=NY-OU,NY-APP
10.30.1.1=SFO-OU, SFO-APP

[NY-OU]
MachineObjectOU=OU=NY Workstations,OU=Computers,<redacted>

[SFO-OU]
MachineObjectOU=OU=SFO Workstations,OU=Computers,<redacted>

[Default]
<redacted>

; Slack
MandatoryApplications001={23a6b7fa-f1b9-47c2-b83e-b46b3b9cb6be}
; Firefox
MandatoryApplications002={a8444ef9-c4b3-4c62-b15f-a193900b4304}
; Edge
MandatoryApplications003={6e40905b-8bea-4134-bc77-37f34f135ecd}

[NY-APP]
; ESET NY
;MandatoryApplications001={80a3773d-6579-4e0c-a96f-29c7e4a020ca}

[SFO-APP]
; ESET SFO
;MandatoryApplications001={80a3773d-6579-4e0c-a96f-29f34jkerwa}

Will this work? I most likely will go with the Task Sequence step but just want to know this one for curiosity sake.Thanks in advance :)

0 Upvotes

9 comments sorted by

2

u/juliuspiv Mar 06 '20

I see what you're trying to achieve here and I suspect there are probably at least a hundred ways to accomplish the goal.

  1. To first answer your question about the gateway: There isd a variable you can reference and I think it's something like Gateway001. I'll have to check the logs on a machine to confirm it but I don't recommend going in that direction.

  2. Your second question about using two values: While I have never tried that, I'm confident it's not going to work.

I'm a pretty hardcore CustomSettings.ini customizer which makes it really challenging for those who come behind me. That said, my approach would be to lay the groundwork for grouping sites within the CustomSettings.ini then do everything via the Task Sequence itself.

[Settings]
Priority=DefaultGateway,Default
Properties=Office,Region

; Define all your gateways here
[DefaultGateway]
172.16.203.254=NY
10.30.1.1=SF0

; Create a separate section for each Office
[NY]
Office=NY
Region=East

[SFO]
Office=SFO
Region=West

; Create a separate section for each Region
[East]
TimeZoneName=Eastern Standard Time

[West]
TimeZoneName=Pacific Standard Time

; Things common to ALL offices/regions go here
[Default]
MachineObjectOU=OU=%Office% Workstations,OU=Computers,<redacted>

Then within the Task Sequence you would have a group for All Offices and then groups for each specific office which would be triggered by the Task Sequence variable 'Office' (e.g.: NY). This makes managing application installation order much easier and keeps the CS.ini pretty lean.

Depending on how many applications you need to lay down, you may want to consider using Application Bundles.

1

u/automation_atw Mar 06 '20

Thank you for taking time to respond to this. That is an amazing idea and we will go with that setup.

I was finally able to get this going after trying few things, was missing the Properties=Office from settings.ini. Thank you again, I've been fighting with this for too long.

1

u/juliuspiv Mar 12 '20

Happy to help.

1

u/automation_atw Mar 06 '20

Another quick question, Do I need to add rest of the sections into priority. Especially because I need the Office section ([SFO] or [NY]) to be processed before [Default] since machine OU is defined in office section, that will be used in [Default] when joining machine to domain.

1

u/juliuspiv Mar 12 '20

In fairly basic terms: The DefaultGateway section will grab your gateway IP, find the IP in the list in the DefaultGateway section then go to whatever section is listed after the equal sign. By adding all of your gateway IPs and assigning the appropriate 'office code', it will go to that offices section and process those office specific rules. By virtue of doing it that way, the office specific code will run before the Default section.

I took some liberties with your example by including a region section which allows you to add region specific things like time zone, keyboard layout, language etc. You can add applications, OU, computer name and all that jazz in the appropriate section.

I'm not a Microsoft MVP but I've been doing it this way for a long time for two different organizations with multiple offices worldwide and a variety of language needs, and this has served me well.

1

u/kwatch Mar 06 '20

You're going to want to take this down and repost it with sanitized information.

1

u/automation_atw Mar 06 '20

I already redacted all sensitive info, is there anything I missed if that is what you are referring to?

1

u/kwatch Mar 06 '20

I wouldn't post your gateways' IPs. They may be local IPs, but I wouldn't post ANY information that is specific to my internal infrastructure on the internet.

1

u/automation_atw Mar 12 '20

Oh yeah totally. in this case those were made up IPs :)