How to enable multiply domainjoin depending on default gateway?

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 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

http://social.technet.microsoft.com/Forums/en-US/configmanagerosd/thread/0c7496dc-5543-489f-ac97-9ed20684d0b3/

Advertisements

SCCM2012: System Discovery fails when configure CM-discovery settings

I stumbled in to this error message today when setting up a lab environment: “Current security context is not associated with an active directory domain or forest. ”

System.DirectoryServices.ActiveDirectory.ActiveDirectoryOperationException: Current security context is not associated with an Active Directory domain or forest.
at System.DirectoryServices.ActiveDirectory.DirectoryContext.GetLoggedOnDomain()
at System.DirectoryServices.ActiveDirectory.DirectoryContext.IsContextValid(DirectoryContext context, DirectoryContextType contextType)
at System.DirectoryServices.ActiveDirectory.DirectoryContext.isDomain()
at System.DirectoryServices.ActiveDirectory.Domain.GetDomain(DirectoryContext context)
at Microsoft.ConfigurationManagement.AdminConsole.ActiveDirectory.Utils.TryParseSiteServerDomain(String domainName, String& ldapPath)
at Microsoft.ConfigurationManagement.AdminConsole.ActiveDirectory.DiscoveryPageControl.ListViewItemAdd()
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Solution? Log on with a domain account on your SCCM server, and not local administrator… 🙂 😉

//Karl