Hello,
Does anybody can help me on this issue please?
I did write a script to capture server primary and secondary DNS through WMI
class, it is working properly with many servers in my environment, but for
some reason that I don't know, it is stopping during execution at line 23
char 30, Error: Type mismatch, code: 800A000D, for some servers, all servers
are in the same domain, with the same architeture, I cannot identify where
VB is getting this error, also I've try with IP address and DNS name, same
problem.
here is the script.
Option Explicit
Dim DNS1, DNS2, objFSO, objFileName, objOutputFile, objMPCLIScript, sptLine,
strIPAddress,strLocation, strLogin, strPassword, objPing, strDC1, strDC2,
objWMIService
Dim colNICConfigs,oSocket, iErr, sSocketText, TelNetConfigure, objShell,
objScriptExec, objRetStatus, objNICConfig, strServerName, NIC, server
Dim inputServerName, inputLocation, inputRsaLogin, inputRsaPass,
inputUserID, inputUserPass, localFolder, testStr
strServerName = "<ServerName>"
on error resume next
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
& strServerName & "\root\cimv2")
If Err <> 0 Then
msgbox strServerName & " - Unable to connect to the
root: " & Err.Number & " - " & Err.Description
Err.Clear
Else
Set colNICConfigs = objWMIService.ExecQuery("SELECT
DNSServerSearchOrder, Description, IPAddress FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
If Err <> 0 Then
msgbox strServerName & " - " & "Unable to connect to
the class Win32_NetworkAdapterConfiguration: " & Err.Number & " - " &
Err.Description
Err.Clear
Else
For Each objNICConfig In colNICConfigs
If Left (objNICConfig.Description, 3) <>
"WAN" Then
NIC = objNICConfig.Description & " - "
& Join (objNICConfig.IPAddress, ",")
DNS1 =
objNICConfig.DNSServerSearchOrder(0)
DNS2 =
objNICConfig.DNSServerSearchOrder(1)
End If
testStr = DNS1 & " ;;;; " & DNS2
Exit For
Next
End IF
End If
wscript.echo testStr
Thank you.
Paulo Matioli