aek Posted March 29, 2005 Posted March 29, 2005 When our machine boots in WinPE, it gets name of DNS Servers for our primary domain from the DHCP Server. This helps us perform AD queries in the primary domain. During our build process we would also want to search in a testing AD Domain. That DNS Server is on a different subnet. We want to add the name of the DNS Server (for that testing domain) in our Win PE process, so that we can also search in that testing AD domain alongwith the primary domain. I am using this VB Code, but it comes back with Automation error. Any help/thoughts on how to get it to work in Win PE Environment?Dim aDNS(3)Dim strComputerDim objWMIServiceDim errDNSDim objItemDim colItems'For all the enthusiasts who will just copy and run this scriptmsgbox "Please write down your DNS Search order: "'DNS server search orderaDNS(0) = "1.1.1.1"aDNS(1) = "1.1.1.2"aDNS(2) = "1.1.1.3"adns(3) = "1.1.1.4"'Set Networking Managing ObjectsstrComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = 1")For Each objItem In colItemserrDNS = objItem.SetDNSServerSearchOrder()'WScript.Sleep 120000errDNS = objItem.SetDNSServerSearchOrder(aDNS)NextSet objWMIService = NothingSet colItems = Nothingmsgbox "Just changed your DNS Search order: "
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now