Computer Services Const ADS_SCOPE_SUBTREE = 2 Set objRoot = Getobject("GC://rootDSE") strRootDomain = objRoot.Get("rootDomainNamingContext") Wscript.Echo strRootDomain 'Wscript.Quit(0) Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCOmmand.ActiveConnection = objConnection objCommand.CommandText = _ 'if You want to query the computers in a ChildDomain ' "Select Name, Location from 'GC://DC=MyChildDomain," & strRootDomain & "'" _ 'if You want to query the computers in a SPECIFIC OU ' "Select Name, Location from 'GC://OU=MySpecificOU," & strRootDomain & "'" _ 'This will query all the computers in the root Domain "Select Name, Location from 'GC://" & strRootDomain & "'" _ & "where objectClass='computer'" objCommand.Properties("Page Size") = 1000 objCommand.Properties("Timeout") = 30 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.Properties("Cache Results") = False Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF ComputerName = objRecordSet.Fields("Name").Value Call ChangeDNS_addy(ComputerName) objRecordSet.MoveNext Loop Set objRecordSet = Nothing Set objCommand = Nothing Set objConnection = Nothing Sub ChangeDNS_addy(ComputerName) On Error Resume Next Set objWMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2") Set colNetCards = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objNetCard in colNetCards arrDNSServers = Array("192.168.11.250", "192.168.11.251", "10.0.0.250") objNetCard.SetDNSServerSearchOrder(arrDNSServers) Next Set colNetCards = Nothing Set objWMIService = Nothing End Sub