Clearing DNS Suffix search order
- From: Jason Anderson <JasonAnderson@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 8 Jun 2007 06:47:04 -0700
I found the following script to set the DNS Suffix search order. What I want
to do is clear those entries and select the "Append Primary and connection
specific DNS suffixies" and the "Append parent suffixies of the parent DNS
suffix". I could not find any connection between those two check boxes in
the interface under the DNS tab and being able to set them.
Any help would be appreciated.
Thanks,
Jason
On Error Resume Next
strComputer = "."
arrNewDNSSuffixSearchOrder = Array("hr.fabrikam.com", "contoso.com")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
strDNSHostName = objNicConfig.DNSHostName
Next
WScript.Echo VbCrLf & "DNS Host Name: " & strDNSHostName
For Each objNicConfig In colNicConfigs
WScript.Echo VbCrLf & _
" Network Adapter " & objNicConfig.Index & VbCrLf & _
" " & objNicConfig.Description & VbCrLf & _
" DNS Domain Suffix Search Order - Before:"
If Not IsNull(objNicConfig.DNSDomainSuffixSearchOrder) Then
For Each strDNSSuffix In objNicConfig.DNSDomainSuffixSearchOrder
WScript.Echo " " & strDNSSuffix
Next
End If
Next
WScript.Echo VbCrLf & String(80, "-")
Set objNetworkSettings =
objWMIService.Get("Win32_NetworkAdapterConfiguration")
intSetSuffixes = _
objNetworkSettings.SetDNSSuffixSearchOrder(arrNewDNSSuffixSearchOrder)
If intSetSuffixes = 0 Then
WScript.Echo VbCrLf & "Replaced DNS domain suffix search order list."
ElseIf intSetSuffixes = 1 Then
WScript.Echo VbCrLf & "Replaced DNS domain suffix search order list." & _
VbCrLf & " Must reboot."
Else
WScript.Echo VbCrLf & "Unable to replace DNS domain suffix " & _
"search order list."
End If
WScript.Echo VbCrLf & String(80, "-")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
WScript.Echo VbCrLf & _
" Network Adapter " & objNicConfig.Index & VbCrLf & _
" " & objNicConfig.Description & VbCrLf & _
" DNS Domain Suffix Search Order - After:"
If Not IsNull(objNicConfig.DNSDomainSuffixSearchOrder) Then
For Each strDNSSuffix In objNicConfig.DNSDomainSuffixSearchOrder
WScript.Echo " " & strDNSSuffix
Next
End If
Next
.
- Prev by Date: Re: Intermittent LDAP 'Table not found' error
- Next by Date: Re: Computer Accounts and Member Of info
- Previous by thread: Re: monitor for file creation using variables
- Next by thread: Re: Computer Accounts and Member Of info
- Index(es):
Loading