|
Thank you all, great input. I will be trying this and will
let you know the outcome.
Victor From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Kline Sent: dinsdag 13 juni 2006 6:18 To: [email protected] Subject: RE: [ActiveDir] DNS - How to tell the static DNS IP-addresses per server Please find a better
VBS script below. The last post was a “while rushing out the door”
effort. There is
now:
Of course the script
assumes that the account with which you’ve logged in has adequate security
permissions on all of the boxes being queried. Richard On Error Resume
Next Const
wbemFlagReturnImmediately = &h10 Const
wbemFlagForwardOnly = &h20 arrComputers =
Array("192.168.1.15","192.168.1.16","192.168.1.154") For Each strComputer In
arrComputers
WScript.Echo
WScript.Echo
"=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo
"==========================================" Set
objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2") Set
colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration where dnshostname is not null", "WQL",
_
wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each
objItem In colItems
WScript.Echo "DNSHostName: " &
objItem.DNSHostName
WScript.Echo "Caption: " & objItem.Caption
strDefaultIPGateway = Join(objItem.DefaultIPGateway,
",")
WScript.Echo "DefaultIPGateway: " &
strDefaultIPGateway
strDNSDomainSuffixSearchOrder = Join(objItem.DNSDomainSuffixSearchOrder,
",")
WScript.Echo "DNSDomainSuffixSearchOrder: " &
strDNSDomainSuffixSearchOrder
WScript.Echo "DNSEnabledForWINSResolution: " &
objItem.DNSEnabledForWINSResolution
strDNSServerSearchOrder = Join(objItem.DNSServerSearchOrder,
",")
WScript.Echo "DNSServerSearchOrder: " &
strDNSServerSearchOrder
WScript.Echo "DomainDNSRegistrationEnabled: " &
objItem.DomainDNSRegistrationEnabled
strIPAddress = Join(objItem.IPAddress, ",")
WScript.Echo "IPAddress: " & strIPAddress
WScript.Echo "WINSEnableLMHostsLookup: " &
objItem.WINSEnableLMHostsLookup
WScript.Echo "WINSHostLookupFile: " &
objItem.WINSHostLookupFile
WScript.Echo "WINSPrimaryServer: " &
objItem.WINSPrimaryServer
WScript.Echo "WINSScopeID: " &
objItem.WINSScopeID
WScript.Echo "WINSSecondaryServer: " &
objItem.WINSSecondaryServer
WScript.Echo
Next Next Function
WMIDateStringToDate(dtmDate) WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" &
_
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4)
_
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) &
":" & Mid(dtmDate,13, 2)) End
Function From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Freddy
HARTONO The only comments to
the wmi below is that it will dump every network cards that you have, is there a
way that you could do it for the primary network card (the one on top of the
binding list?) As for registry key it
will be NameServerList value but still binds to the transport id..(which is
different for all servers) Thank you and have a splendid
day! Kind
Regards, Freddy
Hartono Group Support
Engineer InternationalSOS Pte Ltd mail:
[EMAIL PROTECTED] phone: (+65)
6330-9785 |
