I often work in multiple domain forests. There is often a wish to use only one task sequence for everyone. One problem with this is that you need to have unique step for each domain in regards of the domain join process. And the big question is how do we identify where the computer is located when you deploy? In most of my cases there is one site per domain. This is not always the case. But in this example it is true. So what I do to solve this is that I use Webservice. I know that you can of course make an hta to choose which domain the computer should be a member of, but I wanted this to be Zero Touch. You could also integrate ADSI in the WinPe image and create a script. But this is often complex and it is much easier to use a webservice.
I use this webservice in my setup’s:
http://mdtcustomizations.codeplex.com/releases/view/26318 (Maik Koster’s Deployment Webservice)
I am not going into the steps on how to install the webservice. This is well documented on the mdtcustomizations page.
Okay, so what we need to do now is to customize the customsettings.ini file in order to call the webservice. I added this lines in Red to my customsettings.ini file:
[Settings]
Priority=Default, GetADSite
Properties=MyCustomProperty, ADSite
[Default]
OSInstall=Y
SkipAppsOnUpgrade=YES
SkipCapture=YES
SkipAdminPassword=NO
SkipProductKey=YES
SLShare=\\sccmserver\Logs$
[GetADSite]
WebService=http://webserviceserver/webservice/ad.asmx/GetADSite
ADSite=string
This will return %ADSite% as variable that you can use in your task sequence as soon as you use the gather step like this:

Now you can create custom steps for each ADSite/Domain.

Set your desired OU and Domain and then set the following under Options:

When you do it like this, the only time this step will be run is when your computer is deploying from AD-site named Domain1. You could also use this variable in other things like software that are to be installed. This is meant as a mini-guide. J

