MSFN Forum: Changing Dns Search Order In Win Pe - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Changing Dns Search Order In Win Pe Rate Topic: -----

#1 User is offline   aek 

  • Group: Members
  • Posts: 5
  • Joined: 23-March 05

Posted 29 March 2005 - 11:41 AM

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 strComputer
Dim objWMIService
Dim errDNS
Dim objItem
Dim colItems

'For all the enthusiasts who will just copy and run this script
msgbox "Please write down your DNS Search order: "

'DNS server search order
aDNS(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 Objects
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = 1")

For Each objItem In colItems
errDNS = objItem.SetDNSServerSearchOrder()
'WScript.Sleep 120000
errDNS = objItem.SetDNSServerSearchOrder(aDNS)
Next

Set objWMIService = Nothing
Set colItems = Nothing

msgbox "Just changed your DNS Search order: "


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy