Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 304397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:16:37+00:00 2026-05-12T07:16:37+00:00

I have a type mismatch in my VBScript script. I know that the value

  • 0

I have a type mismatch in my VBScript script. I know that the value is correct, but not sure why it’s coming up.

This is the line where the script terminates:

WScript.Echo "DNS Server Search Order: " & objNicItem.DNSServerSearchOrder

The script requires a file named servers.txt (which has a list of servers in it, I am tesing using my own workstation name).

If I do an error on resume next the script works. However if the servers list is populated. it displays the same information as the fisrt which works again for each host, so it’s not correct.

'Input from the command line
If Wscript.Arguments.Count = 0 Then
    Wscript.Echo "Usage: DNSAudit.vbs servers.txt "
    Wscript.Quit
End If

'Input from txt file
Const ForReading = 1
Set objArgs = WScript.Arguments
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(ObjArgs(0), ForReading)
i = 0
Do Until objTextFile.AtEndOfStream
    StrNextLine = objTextFile.ReadLine
    objDictionary.Add i, StrNextLine
    i = i + 1
Loop
For Each objItem In objDictionary
    Computer = objDictionary.Item(objItem)

    'For Each Computer In Wscript.Arguments

    'remote connection to another computer other than using variables
    'Set ObjWMIService = GetObject("Winmgmts://COMPUTERNAME") for remote connection

    Set ObjWMIService = GetObject("Winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2")
    'If Err.Number <> 0 Then
    'WScript.Echo "**************************************************************"  & vbCrLf
    'WScript.Echo "Connection Errors"  & vbCrLf
    'WScript.Echo Computer & " " & Err.Description
    'WScript.Echo Computer & " " & Err.Description & " investigation required!"
    'WScript.Echo "**************************************************************"  & vbCrLf
    ''*********************************************************************************************************
    'End if
    WScript.Echo "**************************************************************"  & vbCrLf
    WScript.Echo "Starting Audit on " & computer
    WScript.Echo "**************************************************************"  & vbCrLf
    WScript.Echo "**************************************************************"  & vbCrLf
    wscript.echo "List DHCP, DNS, WINS Adapter Parameters"
    wscript.Echo "**************************************************************"  & vbCrLf

    Set colItems = objWMIService.ExecQuery _
        ("Select * from Win32_NetworkAdapterConfiguration")

    For Each objNicItem in colItems
        Wscript.Echo "DHCP Enabled: " & objNicItem.DHCPEnabled
        Wscript.Echo "DHCP Lease Expires: " & objNicItem.DHCPLeaseExpires
        Wscript.Echo "DHCP Lease Obtained: " & objNicItem.DHCPLeaseObtained
        Wscript.Echo "DHCP Server: " & objNicItem.DHCPServer
        Wscript.Echo "DNS Domain: " & objNicItem.DNSDomain
        Wscript.Echo "DNS Domain Suffix Search Order: " & _
            objNicItem.DNSDomainSuffixSearchOrder
        Wscript.Echo "DNS Enabled For WINS Resolution: " & _
            objNicItem.DNSEnabledForWINSResolution
        Wscript.Echo "DNS Host Name: " & objNicItem.DNSHostName
        WScript.Echo "DNS Server Search Order: " & objNicItem.DNSServerSearchOrder
    WScript.Echo "Domain DNS Registration Enabled: " & objNicItem.DomainDNSRegistrationEnabled
        Wscript.Echo "Full DNS Registration Enabled: " & _
            objNicItem.FullDNSRegistrationEnabled
       Wscript.Echo "IP Address: " & objNicItem.IPAddress
       Wscript.Echo "MAC Address: " & objNicItem.MACAddress
        Wscript.Echo "TCP Maximum Data Retransmissions: " & _
            objNicItem.TcpMaxDataRetransmissions
        Wscript.Echo "TCP NumC onnections: " & objNicItem.TcpNumConnections
        Wscript.Echo "WINS Host Lookup File: " & objNicItem.WINSHostLookupFile
        Wscript.Echo "WINS Primary Server: " & objNicItem.WINSPrimaryServer
        Wscript.Echo "WINS Secondary Server: " & objNicItem.WINSSecondaryServer & vbCrLf
        Wscript.Echo "Adaptor: "  & objNicItem.Description & vbCrLf
    Next
Next
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:16:37+00:00Added an answer on May 12, 2026 at 7:16 am

    It’s fully working now with the following code:

    Wscript.Echo "IP Address: " & objNicItem.IPAddress(0)
    

    Thanks Everyone

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 160k
  • Answers 160k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not unless you are running java 6 or later control… May 12, 2026 at 11:37 am
  • Editorial Team
    Editorial Team added an answer The number of characters that will fit depends on the… May 12, 2026 at 11:37 am
  • Editorial Team
    Editorial Team added an answer Turns out I had to set the AutoPostBack property of… May 12, 2026 at 11:37 am

Related Questions

I am trying to separate some asp logic out into a separate page. For
This has always bugged me. Perhaps someone with some hardcore knowledge of .NET internals
I have made a bunch of 2D arrays in Excel, and I have written
I have a Windows forms project and a Web Service project in my solution,
I have developed a solution that relies on an AJAX call to retrieve information

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.