On Error Resume Next
strComputer = "."
arrNewDNSServerSearchOrder = Array("168.126.63.1", "168.126.63.2")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
WScript.Echo VbCrLf & "Computer: " & strComputer
For Each objNicConfig In colNicConfigs
WScript.Echo VbCrLf & " Network Adapter " & objNicConfig.Index
WScript.Echo " DNS Server Search Order - Before:"
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
WScript.Echo " " & strDNSServer
Next
End If
intSetDNSServers = _
objNicConfig.SetDNSServerSearchOrder(arrNewDNSServerSearchOrder)
If intSetDNSServers = 0 Then
WScript.Echo " Replaced DNS server search order list."
Else
WScript.Echo " Unable to replace DNS server search order list."
End If
Next
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
WScript.Echo " DNS Server Search Order - After:"
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
WScript.Echo " " & strDNSServer
Next
End If
Next
해당 파일을 VBS 스크립트로 저장한다.
'Microsoft > Active Directory' 카테고리의 다른 글
Netsh 명령어를 통한 DNS 변경 (0) | 2008.09.02 |
---|---|
AD의 오래된 개체 제거 방법 (0) | 2008.09.02 |
DC 마이그레이션 (0) | 2008.07.25 |
IPSEC을 통한 보안 정책 (0) | 2008.06.25 |