none
How to enable multiply domainjoin depending on default gateway?

    Question

  • Ok so in the environment im working in right now, the SCCM site is working towards two different domains, lets call them "Domain A" & "Domain B". I would like my Task Sequence to join the computers it the right domain depending on what default gateway they have on the network. 

    I will try to illustrate it with pictures:

    And In the options tab i need something like this:

    //Karl


    Karl Wirén Karl Wirén - Operation-Technician - Deployment/Firewall

    Wednesday, August 22, 2012 6:38 AM

Answers

  • I have tried the following, but im afraid neither works:
    Select * from Win32_NetworkAdapterConfiguration where DefaultIPGateway='x.x.x.x'

    This will not work because the adapters are stored in an array.

    I also found a way to do this use this query:
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa394162(v=vs.85).aspx
    Select * FROM Win32_IP4RouteTable
    WHERE Destination='0.0.0.0' AND NextHop='x.x.x.x'

    This queries the routing table, no details about the adapter need to be known. It work's great just in general and in query's but it will not work in a Task Sequence.

    Looks like i have to install MDT. Thank you for all your answers. 

    //Karl Wirén


    • Marked as answer by Karl Wirén Tuesday, August 28, 2012 8:17 AM
    • Edited by Karl Wirén Tuesday, August 28, 2012 8:18 AM
    Tuesday, August 28, 2012 8:17 AM

All replies

  • Hi,

    I would recommend that you have a look at intergrating MDT with your task sequence, then you will have an option to assign roles based on default gateway that can be used for this and many more features.

    Regards,
    Jörgen


    -- My System Center blog ccmexec.com -- Twitter @ccmexec

    Wednesday, August 22, 2012 6:55 AM
  • So there is no way doing this only with SCCM?

    Jörgen do you know any guides of setting domain join depending on location in MDT? 

    //Karl


    Karl Wirén Karl Wirén - Operation-Technician - Deployment/Firewall

    Wednesday, August 22, 2012 7:09 AM
  • You can do this with ConfigMgr, but that requires either custom scripts or a lot of manual work involved. You are already using MDT according to your screenshots. Niall has got many guides about this topic on his website.

    Torsten Meringer | http://www.mssccmfaq.de

    Wednesday, August 22, 2012 7:39 AM
  • Niall describes how to implement MDT with SCCM and how to do basic settings very well, but what i am looking for is documentation regarding domain join based on criterias. In my case criterias based on default gateway or maybe whole subnetranges. 

    If some one have seen any of these documentations/guides it would help me alot. I have searched but not found any doucmentations about this either in SCCM or MDT.

    //Karl

    Wednesday, August 22, 2012 8:34 AM
  • You could use the database integration; that's described here: http://verbalprocessor.com/2012/04/11/dynamic-osd-using-the-mdt-database-2-of-5/. Create a location and assign the default gatways. The example shows joining different OUs, but it can easily be used to join different domain.

    Torsten Meringer | http://www.mssccmfaq.de

    Wednesday, August 22, 2012 8:53 AM
  • You can certainly query the Win32_NetworkAdapterConfiguration class and for the DefaultIPGateway attribute. I can't say I've tried this though but it should work if you correctly craft the query to exclude instances of the class without a DefaultIPGateway attribute set.

    Personally, I would use a script (and have done so in the past) to do this or use MDT (which also uses a script). You could even "gank" that section of the MDT scripts and just use it.

    Also, it is much better (IMO) to set the domain using an Apply Network Settings task before the Setup Windows and ConfigMgr task so that Windows Setup is responsible for joining the domain.


    Jason | http://blog.configmgrftw.com

    Wednesday, August 22, 2012 1:07 PM
  • I was actually considering the Win_32_NetworkAdapterConf :

    Select * from Win32_NetworkAdapterConfiguration where DefaultIPGateway='192.168.40.1'

    But also i have found this that should work similar:

    Select * FROM Win32_IP4RouteTable WHERE Destination='0.0.0.0' AND NextHop='192.168.40.1'

    I will try them both in my lab and see which one works the best for me or if they even will work, future will tell


    • Edited by Karl Wirén Wednesday, August 22, 2012 1:50 PM spelled wrong
    Wednesday, August 22, 2012 1:49 PM
  • I have tried the following, but im afraid neither works:
    Select * from Win32_NetworkAdapterConfiguration where DefaultIPGateway='x.x.x.x'

    This will not work because the adapters are stored in an array.

    I also found a way to do this use this query:
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa394162(v=vs.85).aspx
    Select * FROM Win32_IP4RouteTable
    WHERE Destination='0.0.0.0' AND NextHop='x.x.x.x'

    This queries the routing table, no details about the adapter need to be known. It work's great just in general and in query's but it will not work in a Task Sequence.

    Looks like i have to install MDT. Thank you for all your answers. 

    //Karl Wirén


    • Marked as answer by Karl Wirén Tuesday, August 28, 2012 8:17 AM
    • Edited by Karl Wirén Tuesday, August 28, 2012 8:18 AM
    Tuesday, August 28, 2012 8:17 AM