Use two WMI namespaces in the same subroutine

The attached script works just fine, the command line usage is as follows:
'Usage:
'cscript /nologo inventory.vbs /s:ip.ip.ip.ip  /u:user_name /p:password /c:hd,pc,bios,vid,mem,nic,cpu,hwerr,os,srvc,av,fw
' ip's can be comma seperated... ip's could also be dns-name(s)
' if no parametes are given local host and all parameters are run...
What I'd like to add is the NIC subroutine(line 204ish), I'd like to get the network card's speed... the following code does not work but is an illustration of what I was attempting to do, match the NIC's descriptions in each namespace to return the values from each...

Set objWMIService2 = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set colItems2 = objWMIService.ExecQuery("SELECT * FROM MSNdis_LinkSpeed Where InstanceName = '" & Desc & "'",,48)
For Each objItem2 In colItems2
 WScript.Echo "LinkSpeed: " & objItem.NdisLinkSpeed
The current info the NIC sub returns is in root\cimv2 namespace in the Win32_NetworkAdapterConfiguration class. The network speed data is kept in the root\wmi namespace and the msndis_linkspeed class. I need the data to echo in the same area as the rest of the network data does. The speed returned needs to match each nic, there will be more than one, so NIc_1 should have all the data I get now, plus the speed of Nic_1 and echo it along with the rest of the Nic_1 data...
Thanks!
-rich
'Usage:
'cscript /nologo inventory.vbs /s:ip.ip.ip.ip  /u:user_name /p:password /c:hd,pc,bios,vid,mem,nic,cpu,hwerr,os,srvc,av,fw
' ip's can be comma seperated... ip's could also be dns-name(s)
' if no parametes are given local host and all parameters are run...
Const WbemAuthenticationLevelPktPrivacy = 6

Function ConvertSize(Size)
Do While InStr(Size,",") 'Remove commas from size
    CommaLocate = InStr(Size,",")
    Size = Mid(Size,1,CommaLocate - 1) & _
        Mid(Size,CommaLocate + 1,Len(Size) - CommaLocate)
Loop

Suffix = " Bytes"
If Size >= 1024 Then suffix = " KB"
If Size >= 1048576 Then suffix = " MB"
If Size >= 1073741824 Then suffix = " GB"
If Size >= 1099511627776 Then suffix = " TB"

Select Case Suffix
    Case " KB" Size = Round(Size / 1024, 0)
    Case " MB" Size = Round(Size / 1048576, 0)
    Case " GB" Size = Round(Size / 1073741824, 0)
    Case " TB" Size = Round(Size / 1099511627776, 0)
End Select

ConvertSize = Size & Suffix
End Function

Function WMIDateStringToDate(dtmDate)
On Error Resume Next
    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

If Wscript.Arguments.Named("u") <> "" And Wscript.Arguments.Named("p") <> "" Then
    boolAlternate = True
    strUser = WScript.Arguments.Named("u")
    strPassword = WScript.Arguments.Named("p")
'    WScript.Echo "Using alternate credentials..."
Else
    boolAlternate = False
'    WScript.Echo "Using current credentials..."
End If

If WScript.Arguments.Named("s") = "" Then
    arrComputers = Array(".")
Else
    arrComputers = Split(WScript.Arguments.Named("s"), ",")
End If

For Each strComputer In arrComputers

    If boolAlternate = True Then
        strNamespace = "root\cimv2"
        Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
        Set objWMIService = objwbemLocator.ConnectServer(strComputer, strNamespace, strUser, strPassword)
        objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy
    Else
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    End If

    If Wscript.Arguments.Named("c") <> "" Then
        ' This splits the "/c:" argument by a comma, and goes through each
        arrSections = Split(Wscript.Arguments.Named("c"), ",")
        For Each strSection In arrSections
            Select Case Trim(LCase(strSection))
                Case "hd"
                    HD_Info
                Case "pc"
                    PC_Info
                Case "bios"
                    Bios_Info
                Case "vid"
                    Video_Info
                Case "mem"
                    Memory_Info
                Case "nic"
                    NIC_Info
                Case "cpu"
                    CPU_Info
                Case "hwerr"
                    HW_Err_Info
                Case "os"
                    OS_Info
                Case "srvc"
                    SRVC_Info
                Case "av"
                    AV_Info
                Case "fw"
                    FW_Info
            End Select
        Next
    Else
'        This is where all tests are run
'        WScript.Echo "Running all sections..."
        HD_Info
        PC_Info
        Bios_Info
        Video_Info
        Memory_Info
        NIC_Info
        CPU_Info
        HW_Err_Info
        OS_Info
        SRVC_Info
        AV_Info
        FW_Info
    End If
Next
Sub HD_Info
On Error Resume Next
'    Get Mapped Drive(s) Info
  WScript.Echo  "------Drives------"
    Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where Description = 'Network Connection'")
    For Each objItem in colItems
        WScript.Echo  "----Mapped----"
        WScript.Echo  "VolumeName  : " & objItem.VolumeName
        WScript.Echo  "Description : " & objItem.Description
        WScript.Echo  "Name        : " & objItem.Name
        WScript.Echo  "DeviceID    : " & objItem.DeviceID
        WScript.Echo  "Size        : " & ConvertSize(objItem.Size)
        Wscript.Echo  "FreeSpace   : " & ConvertSize(objItem.FreeSpace)
        Wscript.Echo  "FileSystem  : " & objItem.FileSystem
        WScript.Echo  "ProviderName: " & objItem.ProviderName
        Wscript.Echo  "SerialNumber: " & objItem.VolumeSerialNumber
    Next
'    Get Harddrive(s) Info
    Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where Description = 'Local Fixed Disk'")
    For Each objItem in colItems
        WScript.Echo  "----HD----"
        WScript.Echo  "VolumeName  : " & objItem.VolumeName
        WScript.Echo  "Description : " & objItem.Description
        WScript.Echo  "Name        : " & objItem.Name
        WScript.Echo  "DeviceID    : " & objItem.DeviceID
        WScript.Echo  "Size        : " & ConvertSize(objItem.Size)
        Wscript.Echo  "FreeSpace   : " & ConvertSize(objItem.FreeSpace)
        Wscript.Echo  "FileSystem  : " & objItem.FileSystem
        Wscript.Echo  "SerialNumber: " & objItem.VolumeSerialNumber
    Next
End Sub
'    Get Local Login Information
Sub PC_Info
        WScript.Echo  "------Login------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
    For Each objItem in colItems
        Wscript.Echo  "Caption     : " & objItem.Caption
        Wscript.Echo  "TimeZone    : " & objItem.CurrentTimeZone
        Wscript.Echo  "Description : " & objItem.Description
        Wscript.Echo  "Domain Role : " & objItem.DomainRole
        Wscript.Echo  "Manufacturer: " & objItem.Manufacturer
        Wscript.Echo  "Model       : " & objItem.Model
        Wscript.Echo  "Name        : " & objItem.Name
        Wscript.Echo  "Domain      : " & objItem.Domain
        Wscript.Echo  "UserName    : " & objItem.UserName
    Next
End Sub

'    Get Bios info, includng Asset Tag, Bios Revision and Manufacturer
Sub Bios_Info
  WScript.Echo  "------Bios------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
    For Each objItem in colItems
        Wscript.Echo  "BuildNumber : " & objItem.BuildNumber
        Wscript.Echo  "ReleaseDate : " & WMIDateStringToDate(objItem.ReleaseDate)
        Wscript.Echo  "Description : " & objItem.Description
        Wscript.Echo  "Manufacturer: " & objItem.Manufacturer
        Wscript.Echo  "Name        : " & objItem.Name
        Wscript.Echo  "SerialNumber: " & objItem.SerialNumber
        Wscript.Echo  "Version     : " & objItem.Version
    Next
End Sub

'    Get Screen Resolution, Refreash and Video Card info
Sub Video_Info
  WScript.Echo  "------Vid------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_DisplayControllerConfiguration",,48)
    For Each objItem in colItems
        Wscript.Echo  "Description: " & objItem.Description
        Wscript.Echo  "Name       : " & objItem.Name
        Wscript.Echo  "RefreshRate: " & objItem.RefreshRate
        Wscript.Echo  "VideoMode  : " & objItem.VideoMode
    Next
End Sub

'    Get Memory Information
Sub Memory_Info
  WScript.Echo  "------Mem------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalMemoryConfiguration",,48)
    For Each objItem in colItems
        Wscript.Echo  "FreeVirtMem: " & ConvertSize(objItem.AvailableVirtualMemory * 1024)
        Wscript.Echo  "TotPgFileSz: " & ConvertSize(objItem.TotalPageFileSpace * 1024)
        Wscript.Echo  "TotPhyMem  : " & ConvertSize(objItem.TotalPhysicalMemory * 1024)
        Wscript.Echo  "TotVirtMem : " & ConvertSize(objItem.TotalVirtualMemory * 1024)
    Next
End Sub

'    Get NIC information
Sub NIC_Info
On Error Resume Next
  WScript.Echo  "------Net------"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration " & "Where IPEnabled = True")
        For Each objItem in colItems
  WScript.Echo  "----Nic----"
        ' Beginning of Adapter specific information
        Wscript.Echo  "Caption   : " & objItem.Caption
        If Not IsNull(objItem.DNSDomainSuffixSearchOrder) Then
          Dim strDefaultIPGateway : strDefaultIPGateway = Join(objItem.DefaultIPGateway, ",")
  Wscript.Echo "DfltGtwy : " & strDefaultIPGateway
        End If
        Wscript.Echo "Description: " & objItem.Description
        If Not IsNull(objItem.DNSDomainSuffixSearchOrder) Then
          Dim strDNSDomainSuffixSearchOrder : strDNSDomainSuffixSearchOrder = Join(objItem.DNSDomainSuffixSearchOrder, ",")
        Wscript.Echo "DNSSrchOrdr: " & strDNSDomainSuffixSearchOrder
        End If
        Wscript.Echo "DHCPEnabled: " & objItem.DHCPEnabled
        Wscript.Echo "MACAddress : " & objItem.MACAddress
        Wscript.Echo "WINSPriSrvr: " & objItem.WINSPrimaryServer
        Wscript.Echo "WINSSecSrvr: " & objItem.WINSSecondaryServer
        ' Beginning IP Address Listing
        Dim i
        For i = 0 To UBound (objItem.IPAddress)
  Wscript.Echo "IPAddress  : " & objItem.IPAddress(i)
  Wscript.Echo "Subnet     : " & objItem.IPSubnet(i)
      Next
    Next
End Sub

'    Get CPU Information
Sub CPU_Info
  WScript.Echo  "------Processor------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
    For Each objItem in colItems
        Wscript.Echo "----CPU----"
        Wscript.Echo  "DeviceID   : " & objItem.DeviceID
        Wscript.Echo  "Caption    : " & objItem.Caption
        Wscript.Echo  "ClockSpeed : " & objItem.CurrentClockSpeed
        Wscript.Echo  "Description: " & objItem.Description
        Wscript.Echo  "Family     : " & objItem.Family
        Wscript.Echo  "Load%      : " & objItem.LoadPercentage
        Wscript.Echo  "Name       : " & objItem.Name
    Next
End Sub

'    Show non-functioning Devices (yellow exclamation point, or red circle)
Sub HW_Err_Info
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_PNPEntity Where ConfigManagerErrorCode <> 0")

        WScript.Echo  "------Errors------"
    For Each objItem in colItems
        Wscript.Echo "----HW-ERR----"
        Wscript.Echo  "Name       : " & objItem.Name
        Wscript.Echo  "Description: " & objItem.Description
        Wscript.Echo  "DeviceID   : " & objItem.DeviceID
        Wscript.Echo  "Manufacturer: " & objItem.Manufacturer
    Next
End Sub

Sub OS_Info
On Error Resume Next
  WScript.Echo  "------PC Info------"
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
        For Each objItem in colItems
  WScript.Echo "CountryCode: " & objItem.CountryCode
  WScript.Echo "CSDVersion : " & objItem.CSDVersion
  WScript.Echo "CSName     : " & objItem.CSName
  WScript.Echo "TimeZone   : " & objItem.CurrentTimeZone
  WScript.Echo "FreePhysMem: " & ConvertSize(objItem.FreePhysicalMemory * 1024)
  WScript.Echo "FreePgFlSpc: " & ConvertSize(objItem.FreeSpaceInPagingFiles * 1024)
  WScript.Echo "FreeVirtMem: " & ConvertSize(objItem.FreeVirtualMemory * 1024)
  WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate)
  WScript.Echo "LstBootTime: " & WMIDateStringToDate(objItem.LastBootUpTime)
  WScript.Echo "LocalTime  : " & WMIDateStringToDate(objItem.LocalDateTime)
  WScript.Echo "Locale     : " & objItem.Locale
  WScript.Echo "NumProcess : " & objItem.NumberOfProcesses
  WScript.Echo "NumOfUsers : " & objItem.NumberOfUsers
  WScript.Echo "Org        : " & objItem.Organization
  WScript.Echo "OSLanguage : " & objItem.OSLanguage
  WScript.Echo "ProductSuite: " & objItem.OSProductSuite
  WScript.Echo "OSType     : " & objItem.OSType
  WScript.Echo "ProductType: " & objItem.ProductType
  WScript.Echo "RegisteredUsr: " & objItem.RegisteredUser
  WScript.Echo "SerialNum  : " & objItem.SerialNumber
  WScript.Echo "SPMajorVer : " & objItem.ServicePackMajorVersion
  WScript.Echo "SPMinorVer : " & objItem.ServicePackMinorVersion
  WScript.Echo "TotVirtMem : " & ConvertSize(objItem.TotalVirtualMemorySize * 1024)
  WScript.Echo "TotVisMem  : " & ConvertSize(objItem.TotalVisibleMemorySize * 1024)
  WScript.Echo "Version    : " & objItem.Version
Next
End Sub

Sub SRVC_Info
On Error Resume Next
       WScript.Echo  "------Service Info------"
     Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Service",,48)
  For Each objItem In colItems
  WScript.Echo "----" & objItem.Caption & "----"
  WScript.Echo "AcceptPause : " & objItem.AcceptPause
  WScript.Echo "AcceptStop  : " & objItem.AcceptStop
  WScript.Echo "DesktopInteract: " & objItem.DesktopInteract
  WScript.Echo "DisplayName : " & objItem.DisplayName
  WScript.Echo "ErrorControl: " & objItem.ErrorControl
  WScript.Echo "Name        : " & objItem.Name
  WScript.Echo "PathName    : " & objItem.PathName
  WScript.Echo "ProcessId   : " & objItem.ProcessId
  WScript.Echo "Started     : " & objItem.Started
  WScript.Echo "StartMode   : " & objItem.StartMode
  WScript.Echo "StartName   : " & objItem.StartName
  WScript.Echo "State       : " & objItem.State
  WScript.Echo " "
  Next
End Sub


Sub AV_Info
On Error Resume Next
       WScript.Echo  "------AV------"
Set oWMIAV = GetObject ("winmgmts:\\" & strComputer & "\root\SecurityCenter")
Set colItems = oWMIAV.ExecQuery("Select * from AntiVirusProduct",,48)

If Err = 0 Then
   For Each objAVProduct In colItems
  WScript.Echo "companyName: " & objAVProduct.companyName
  WScript.Echo "displayName: " & objAVProduct.displayName
  WScript.Echo "enableOnAccessUIMd5Hash: " & objAVProduct.enableOnAccessUIMd5Hash
  WScript.Echo "enableOnAccessUIParameters: " & objAVProduct.enableOnAccessUIParameters
  WScript.Echo "instanceGuid: " & objAVProduct.instanceGuid
  WScript.Echo "onAccessScanningEnabled: " & objAVProduct.onAccessScanningEnabled
  WScript.Echo "pathToEnableOnAccessUI: " & objAVProduct.pathToEnableOnAccessUI
  WScript.Echo "pathToUpdateUI: " & objAVProduct.pathToUpdateUI
  WScript.Echo "productUptoDate: " & objAVProduct.productUptoDate
  WScript.Echo "updateUIMd5Hash: " & objAVProduct.updateUIMd5Hash
  WScript.Echo "updateUIParameters: " & objAVProduct.updateUIParameters
  WScript.Echo "versionNumber: " & objAVProduct.versionNumber
  Next
    Else
  Err.Clear
  WScript.Echo "Unable to connect to SecurityCenter class on " & strComputer
  WScript.Echo "Number     : " & Err.Number
  WScript.Echo "Source     : " & Err.Source
  WScript.Echo "Description: " & Err.Description
      End If
End Sub

Sub FW_Info
  WScript.Echo  "------FW------"
On Error Resume Next
Set oWMIFW = GetObject ("winmgmts:\\" & strComputer & "\root\SecurityCenter")
Set colItems = oWMIFW.ExecQuery("Select * from FirewallProduct",,48)
If Err = 0 Then
   For Each objFWProduct In colItems
  WScript.Echo "companyName: " & objFWProduct.companyName
  WScript.Echo "displayName: " & objFWProduct.displayName
  WScript.Echo "enableUIMd5Hash: " & objFWProduct.enableUIMd5Hash
  WScript.Echo "enableUIParameters: " & objFWProduct.enableUIParameters
  WScript.Echo "instanceGuid: " & objFWProduct.instanceGuid
  WScript.Echo "pathToEnableOnUI: " & objFWProduct.pathToEnableOnUI
  WScript.Echo "versionNumber: " & objFWProduct.versionNumber
   Next
    Else
      Err.Clear
  WScript.Echo "Unable to connect to SecurityCenter class on " & strComputer
  WScript.Echo "Number     : " & Err.Number
  WScript.Echo "Source     : " & Err.Source
  WScript.Echo "Description: " & Err.Description
    End If
End Sub

Open in new window

LVL 38
Rich RumbleSecurity SamuraiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Justin EllenbeckerIT DirectorCommented:
Set objWMIService2 = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set colItems2 = objWMIService.ExecQuery("SELECT * FROM MSNdis_LinkSpeed

When you exec the query you are using your original wmi service try making service2
0
Rich RumbleSecurity SamuraiAuthor Commented:
I didn't write much of this script, so I really have no idea how to tie it all in, I assume my example code should of said "objWMIService2.ExecQuery("SELECT  etc..." instead. Nonetheless, I don't know how to read the description from what is currently returned, set it as something for the second namesapce/class to use in the where clause...
-rich
0
Rich RumbleSecurity SamuraiAuthor Commented:
Dot dot dot...
-rich
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Chris DentPowerShell DeveloperCommented:

Hi Rich,

This should directly replace the NIC_Info subroutine.

Link speed is added at the bottom using the Win32_NetworkAdapter class. I haven't done anything with the value, it would probably make sense to clean that up a bit though.

Chris
Sub NIC_Info

  ' Return network adapter information

  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  Set colNICConfig = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")

  For Each objNICConfig in colNICConfig

    WScript.Echo  "----Nic----"
  
    ' Beginning of Adapter specific information
    Wscript.Echo  "Caption    : " & objNICConfig.Caption

    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDefaultIPGateway
      strDefaultIPGateway = Join(objNICConfig.DefaultIPGateway, ",")

      Wscript.Echo "DfltGtwy   : " & strDefaultIPGateway
    End If

    Wscript.Echo "Description: " & objNICConfig.Description
    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDNSDomainSuffixSearchOrder
      strDNSDomainSuffixSearchOrder = Join(objNICConfig.DNSDomainSuffixSearchOrder, ",")

      Wscript.Echo "DNSSrchOrdr: " & strDNSDomainSuffixSearchOrder
    End If

    Wscript.Echo "DHCPEnabled: " & objNICConfig.DHCPEnabled
    Wscript.Echo "MACAddress : " & objNICConfig.MACAddress
    Wscript.Echo "WINSPriSrvr: " & objNICConfig.WINSPrimaryServer
    Wscript.Echo "WINSSecSrvr: " & objNICConfig.WINSSecondaryServer
 
    ' Beginning IP Address Listing
    Dim i
    For i = 0 To UBound (objNICConfig.IPAddress)
      Wscript.Echo "IPAddress  : " & objNICConfig.IPAddress(i)
      Wscript.Echo "Subnet     : " & objNICConfig.IPSubnet(i)
    Next

    Set colNIC = objWMIService.ExecQuery("ASSOCIATORS OF " & _
      "{Win32_NetworkAdapterConfiguration.Index='" & objNICConfig.Index & "'}") ' & _
      ' "WHERE AssocClass=Win32_NetworkAdapterSetting")

    For Each objNIC in colNIC
      Wscript.Echo "LinkSpeed  : " & objNIC.Speed
    Next
  Next
End Sub

Open in new window

0
Rich RumbleSecurity SamuraiAuthor Commented:
I recieved this error running it local
 inv.vbs(215, 7) Microsoft VBScript runtime error: Invalid use of Null: 'Join'
THe first NIC works, then the second begins to fail...
...
Subnet     : 255.255.255.0
LinkSpeed  :
----Nic----
Caption    : [00000010] VMware Virtual Ethernet Adapter for VMnet1
C:\scripts\inv.vbs(215, 7) Microsoft VBScript runtime error: Invalid use of Null: 'Join'

and this running remote (cscript /nologo inv.vbs /s:1.2.3.4 /c:nic)
inv.vbs(207, 3) Microsoft VBScript runtime error: Permission denied: 'GetObject' (ran as admin btw)

Attached the script again. Running the script local on the machine that gave the access denied error it works with no errors but the linkspeed does not show. Running the script from this same remote machine to the first gives the same "Join" error. Below is the output of my script before replacing with your code on the "join" error machine.
------Net------
----Nic----
Caption   : [00000008] Intel(R) 82566DM-2 Gigabit Network Connection
DfltGtwy : 10.10.251.250
Description: Intel(R) 82566DM-2 Gigabit Network Connection - Packet Scheduler Miniport
DNSSrchOrdr: ops.ad
DHCPEnabled: False
MACAddress : 00:11:4F:54:9A:8F
WINSPriSrvr: 10.10.11.4
WINSSecSrvr:
IPAddress  : 10.10.251.10
Subnet     : 255.255.255.0
----Nic----
Caption   : [00000010] VMware Virtual Ethernet Adapter for VMnet1
DfltGtwy : 10.10.251.250
Description: VMware Virtual Ethernet Adapter for VMnet1
DNSSrchOrdr: ops.ad
DHCPEnabled: False
MACAddress : 00:10:56:C0:00:01
WINSPriSrvr:
WINSSecSrvr:
IPAddress  : 192.168.19.1
Subnet     : 255.255.255.0
----Nic----
Caption   : [00000011] VMware Virtual Ethernet Adapter for VMnet8
DfltGtwy : 10.10.251.250
Description: VMware Virtual Ethernet Adapter for VMnet8
DNSSrchOrdr: ops.ad
DHCPEnabled: False
MACAddress : 00:10:56:C0:00:08
WINSPriSrvr:
WINSSecSrvr:
IPAddress  : 192.168.189.1
Subnet     : 255.255.255.0

Thanks again, I think were really close!
-rich
'Usage:
'cscript /nologo inventory.vbs /s:ip.ip.ip.ip  /u:user_name /p:password /c:hd,pc,bios,vid,mem,nic,cpu,hwerr,os,srvc,av,fw
' ip's can be comma seperated... ip's could also be dns-name(s)
' if no parametes are given local host and all parameters are run...
Const WbemAuthenticationLevelPktPrivacy = 6

Function ConvertSize(Size)
Do While InStr(Size,",") 'Remove commas from size
    CommaLocate = InStr(Size,",")
    Size = Mid(Size,1,CommaLocate - 1) & _
        Mid(Size,CommaLocate + 1,Len(Size) - CommaLocate)
Loop

Suffix = " Bytes"
If Size >= 1024 Then suffix = " KB"
If Size >= 1048576 Then suffix = " MB"
If Size >= 1073741824 Then suffix = " GB"
If Size >= 1099511627776 Then suffix = " TB"

Select Case Suffix
    Case " KB" Size = Round(Size / 1024, 0)
    Case " MB" Size = Round(Size / 1048576, 0)
    Case " GB" Size = Round(Size / 1073741824, 0)
    Case " TB" Size = Round(Size / 1099511627776, 0)
End Select

ConvertSize = Size & Suffix
End Function

Function WMIDateStringToDate(dtmDate)
On Error Resume Next
    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

If Wscript.Arguments.Named("u") <> "" And Wscript.Arguments.Named("p") <> "" Then
    boolAlternate = True
    strUser = WScript.Arguments.Named("u")
    strPassword = WScript.Arguments.Named("p")
'    WScript.Echo "Using alternate credentials..."
Else
    boolAlternate = False
'    WScript.Echo "Using current credentials..."
End If

If WScript.Arguments.Named("s") = "" Then
    arrComputers = Array(".")
Else
    arrComputers = Split(WScript.Arguments.Named("s"), ",")
End If

For Each strComputer In arrComputers

    If boolAlternate = True Then
        strNamespace = "root\cimv2"
        Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
        Set objWMIService = objwbemLocator.ConnectServer(strComputer, strNamespace, strUser, strPassword)
        objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy
    Else
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    End If

    If Wscript.Arguments.Named("c") <> "" Then
        ' This splits the "/c:" argument by a comma, and goes through each
        arrSections = Split(Wscript.Arguments.Named("c"), ",")
        For Each strSection In arrSections
            Select Case Trim(LCase(strSection))
                Case "hd"
                    HD_Info
                Case "pc"
                    PC_Info
                Case "bios"
                    Bios_Info
                Case "vid"
                    Video_Info
                Case "mem"
                    Memory_Info
                Case "nic"
                    NIC_Info
                Case "cpu"
                    CPU_Info
                Case "hwerr"
                    HW_Err_Info
                Case "os"
                    OS_Info
                Case "srvc"
                    SRVC_Info
                Case "av"
                    AV_Info
                Case "fw"
                    FW_Info
            End Select
        Next
    Else
'        This is where all tests are run
'        WScript.Echo "Running all sections..."
        HD_Info
        PC_Info
        Bios_Info
        Video_Info
        Memory_Info
        NIC_Info
        CPU_Info
        HW_Err_Info
        OS_Info
        SRVC_Info
        AV_Info
        FW_Info
    End If
Next
Sub HD_Info
On Error Resume Next
'    Get Mapped Drive(s) Info
  WScript.Echo  "------Drives------"
    Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where Description = 'Network Connection'")
    For Each objItem in colItems
        WScript.Echo  "----Mapped----"
        WScript.Echo  "VolumeName  : " & objItem.VolumeName
        WScript.Echo  "Description : " & objItem.Description
        WScript.Echo  "Name        : " & objItem.Name
        WScript.Echo  "DeviceID    : " & objItem.DeviceID
        WScript.Echo  "Size        : " & ConvertSize(objItem.Size)
        Wscript.Echo  "FreeSpace   : " & ConvertSize(objItem.FreeSpace)
        Wscript.Echo  "FileSystem  : " & objItem.FileSystem
        WScript.Echo  "ProviderName: " & objItem.ProviderName
        Wscript.Echo  "SerialNumber: " & objItem.VolumeSerialNumber
    Next
'    Get Harddrive(s) Info
    Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where Description = 'Local Fixed Disk'")
    For Each objItem in colItems
        WScript.Echo  "----HD----"
        WScript.Echo  "VolumeName  : " & objItem.VolumeName
        WScript.Echo  "Description : " & objItem.Description
        WScript.Echo  "Name        : " & objItem.Name
        WScript.Echo  "DeviceID    : " & objItem.DeviceID
        WScript.Echo  "Size        : " & ConvertSize(objItem.Size)
        Wscript.Echo  "FreeSpace   : " & ConvertSize(objItem.FreeSpace)
        Wscript.Echo  "FileSystem  : " & objItem.FileSystem
        Wscript.Echo  "SerialNumber: " & objItem.VolumeSerialNumber
    Next
End Sub
'    Get Local Login Information
Sub PC_Info
        WScript.Echo  "------Login------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
    For Each objItem in colItems
        Wscript.Echo  "Caption     : " & objItem.Caption
        Wscript.Echo  "TimeZone    : " & objItem.CurrentTimeZone
        Wscript.Echo  "Description : " & objItem.Description
        Wscript.Echo  "Domain Role : " & objItem.DomainRole
        Wscript.Echo  "Manufacturer: " & objItem.Manufacturer
        Wscript.Echo  "Model       : " & objItem.Model
        Wscript.Echo  "Name        : " & objItem.Name
        Wscript.Echo  "Domain      : " & objItem.Domain
        Wscript.Echo  "UserName    : " & objItem.UserName
    Next
End Sub

'    Get Bios info, includng Asset Tag, Bios Revision and Manufacturer
Sub Bios_Info
  WScript.Echo  "------Bios------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
    For Each objItem in colItems
        Wscript.Echo  "BuildNumber : " & objItem.BuildNumber
        Wscript.Echo  "ReleaseDate : " & WMIDateStringToDate(objItem.ReleaseDate)
        Wscript.Echo  "Description : " & objItem.Description
        Wscript.Echo  "Manufacturer: " & objItem.Manufacturer
        Wscript.Echo  "Name        : " & objItem.Name
        Wscript.Echo  "SerialNumber: " & objItem.SerialNumber
        Wscript.Echo  "Version     : " & objItem.Version
    Next
End Sub

'    Get Screen Resolution, Refreash and Video Card info
Sub Video_Info
  WScript.Echo  "------Vid------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_DisplayControllerConfiguration",,48)
    For Each objItem in colItems
        Wscript.Echo  "Description: " & objItem.Description
        Wscript.Echo  "Name       : " & objItem.Name
        Wscript.Echo  "RefreshRate: " & objItem.RefreshRate
        Wscript.Echo  "VideoMode  : " & objItem.VideoMode
    Next
End Sub

'    Get Memory Information
Sub Memory_Info
  WScript.Echo  "------Mem------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalMemoryConfiguration",,48)
    For Each objItem in colItems
        Wscript.Echo  "FreeVirtMem: " & ConvertSize(objItem.AvailableVirtualMemory * 1024)
        Wscript.Echo  "TotPgFileSz: " & ConvertSize(objItem.TotalPageFileSpace * 1024)
        Wscript.Echo  "TotPhyMem  : " & ConvertSize(objItem.TotalPhysicalMemory * 1024)
        Wscript.Echo  "TotVirtMem : " & ConvertSize(objItem.TotalVirtualMemory * 1024)
    Next
End Sub

'    Get NIC information
Sub NIC_Info
  ' Return network adapter information
  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  Set colNICConfig = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")
  For Each objNICConfig in colNICConfig
    WScript.Echo  "----Nic----"
    ' Beginning of Adapter specific information
    Wscript.Echo  "Caption    : " & objNICConfig.Caption
    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDefaultIPGateway
      strDefaultIPGateway = Join(objNICConfig.DefaultIPGateway, ",")
      Wscript.Echo "DfltGtwy   : " & strDefaultIPGateway
    End If
    Wscript.Echo "Description: " & objNICConfig.Description
    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDNSDomainSuffixSearchOrder
      strDNSDomainSuffixSearchOrder = Join(objNICConfig.DNSDomainSuffixSearchOrder, ",")
      Wscript.Echo "DNSSrchOrdr: " & strDNSDomainSuffixSearchOrder
    End If
    Wscript.Echo "DHCPEnabled: " & objNICConfig.DHCPEnabled
    Wscript.Echo "MACAddress : " & objNICConfig.MACAddress
    Wscript.Echo "WINSPriSrvr: " & objNICConfig.WINSPrimaryServer
    Wscript.Echo "WINSSecSrvr: " & objNICConfig.WINSSecondaryServer
    ' Beginning IP Address Listing
    Dim i
    For i = 0 To UBound (objNICConfig.IPAddress)
      Wscript.Echo "IPAddress  : " & objNICConfig.IPAddress(i)
      Wscript.Echo "Subnet     : " & objNICConfig.IPSubnet(i)
    Next
    Set colNIC = objWMIService.ExecQuery("ASSOCIATORS OF " & _
      "{Win32_NetworkAdapterConfiguration.Index='" & objNICConfig.Index & "'}") ' & _
      ' "WHERE AssocClass=Win32_NetworkAdapterSetting")
    For Each objNIC in colNIC
      Wscript.Echo "LinkSpeed  : " & objNIC.Speed
    Next
  Next
End Sub


'    Get CPU Information
Sub CPU_Info
  WScript.Echo  "------Processor------"
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
    For Each objItem in colItems
        Wscript.Echo "----CPU----"
        Wscript.Echo  "DeviceID   : " & objItem.DeviceID
        Wscript.Echo  "Caption    : " & objItem.Caption
        Wscript.Echo  "ClockSpeed : " & objItem.CurrentClockSpeed
        Wscript.Echo  "Description: " & objItem.Description
        Wscript.Echo  "Family     : " & objItem.Family
        Wscript.Echo  "Load%      : " & objItem.LoadPercentage
        Wscript.Echo  "Name       : " & objItem.Name
    Next
End Sub

'    Show non-functioning Devices (yellow exclamation point, or red circle)
Sub HW_Err_Info
On Error Resume Next
    Set colItems = objWMIService.ExecQuery("Select * from Win32_PNPEntity Where ConfigManagerErrorCode <> 0")

        WScript.Echo  "------Errors------"
    For Each objItem in colItems
        Wscript.Echo "----HW-ERR----"
        Wscript.Echo  "Name       : " & objItem.Name
        Wscript.Echo  "Description: " & objItem.Description
        Wscript.Echo  "DeviceID   : " & objItem.DeviceID
        Wscript.Echo  "Manufacturer: " & objItem.Manufacturer
    Next
End Sub

Sub OS_Info
On Error Resume Next
  WScript.Echo  "------PC Info------"
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
        For Each objItem in colItems
  WScript.Echo "CountryCode: " & objItem.CountryCode
  WScript.Echo "CSDVersion : " & objItem.CSDVersion
  WScript.Echo "CSName     : " & objItem.CSName
  WScript.Echo "TimeZone   : " & objItem.CurrentTimeZone
  WScript.Echo "FreePhysMem: " & ConvertSize(objItem.FreePhysicalMemory * 1024)
  WScript.Echo "FreePgFlSpc: " & ConvertSize(objItem.FreeSpaceInPagingFiles * 1024)
  WScript.Echo "FreeVirtMem: " & ConvertSize(objItem.FreeVirtualMemory * 1024)
  WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate)
  WScript.Echo "LstBootTime: " & WMIDateStringToDate(objItem.LastBootUpTime)
  WScript.Echo "LocalTime  : " & WMIDateStringToDate(objItem.LocalDateTime)
  WScript.Echo "Locale     : " & objItem.Locale
  WScript.Echo "NumProcess : " & objItem.NumberOfProcesses
  WScript.Echo "NumOfUsers : " & objItem.NumberOfUsers
  WScript.Echo "Org        : " & objItem.Organization
  WScript.Echo "OSLanguage : " & objItem.OSLanguage
  WScript.Echo "ProductSuite: " & objItem.OSProductSuite
  WScript.Echo "OSType     : " & objItem.OSType
  WScript.Echo "ProductType: " & objItem.ProductType
  WScript.Echo "RegisteredUsr: " & objItem.RegisteredUser
  WScript.Echo "SerialNum  : " & objItem.SerialNumber
  WScript.Echo "SPMajorVer : " & objItem.ServicePackMajorVersion
  WScript.Echo "SPMinorVer : " & objItem.ServicePackMinorVersion
  WScript.Echo "TotVirtMem : " & ConvertSize(objItem.TotalVirtualMemorySize * 1024)
  WScript.Echo "TotVisMem  : " & ConvertSize(objItem.TotalVisibleMemorySize * 1024)
  WScript.Echo "Version    : " & objItem.Version
Next
End Sub

Sub SRVC_Info
On Error Resume Next
       WScript.Echo  "------Service Info------"
     Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Service",,48)
  For Each objItem In colItems
  WScript.Echo "----" & objItem.Caption & "----"
  WScript.Echo "AcceptPause : " & objItem.AcceptPause
  WScript.Echo "AcceptStop  : " & objItem.AcceptStop
  WScript.Echo "DesktopInteract: " & objItem.DesktopInteract
  WScript.Echo "DisplayName : " & objItem.DisplayName
  WScript.Echo "ErrorControl: " & objItem.ErrorControl
  WScript.Echo "Name        : " & objItem.Name
  WScript.Echo "PathName    : " & objItem.PathName
  WScript.Echo "ProcessId   : " & objItem.ProcessId
  WScript.Echo "Started     : " & objItem.Started
  WScript.Echo "StartMode   : " & objItem.StartMode
  WScript.Echo "StartName   : " & objItem.StartName
  WScript.Echo "State       : " & objItem.State
  WScript.Echo " "
  Next
End Sub


Sub AV_Info
On Error Resume Next
       WScript.Echo  "------AV------"
Set oWMIAV = GetObject ("winmgmts:\\" & strComputer & "\root\SecurityCenter")
Set colItems = oWMIAV.ExecQuery("Select * from AntiVirusProduct",,48)

If Err = 0 Then
   For Each objAVProduct In colItems
  WScript.Echo "companyName: " & objAVProduct.companyName
  WScript.Echo "displayName: " & objAVProduct.displayName
  WScript.Echo "enableOnAccessUIMd5Hash: " & objAVProduct.enableOnAccessUIMd5Hash
  WScript.Echo "enableOnAccessUIParameters: " & objAVProduct.enableOnAccessUIParameters
  WScript.Echo "instanceGuid: " & objAVProduct.instanceGuid
  WScript.Echo "onAccessScanningEnabled: " & objAVProduct.onAccessScanningEnabled
  WScript.Echo "pathToEnableOnAccessUI: " & objAVProduct.pathToEnableOnAccessUI
  WScript.Echo "pathToUpdateUI: " & objAVProduct.pathToUpdateUI
  WScript.Echo "productUptoDate: " & objAVProduct.productUptoDate
  WScript.Echo "updateUIMd5Hash: " & objAVProduct.updateUIMd5Hash
  WScript.Echo "updateUIParameters: " & objAVProduct.updateUIParameters
  WScript.Echo "versionNumber: " & objAVProduct.versionNumber
  Next
    Else
  Err.Clear
  WScript.Echo "Unable to connect to SecurityCenter class on " & strComputer
  WScript.Echo "Number     : " & Err.Number
  WScript.Echo "Source     : " & Err.Source
  WScript.Echo "Description: " & Err.Description
      End If
End Sub

Sub FW_Info
  WScript.Echo  "------FW------"
On Error Resume Next
Set oWMIFW = GetObject ("winmgmts:\\" & strComputer & "\root\SecurityCenter")
Set colItems = oWMIFW.ExecQuery("Select * from FirewallProduct",,48)
If Err = 0 Then
   For Each objFWProduct In colItems
  WScript.Echo "companyName: " & objFWProduct.companyName
  WScript.Echo "displayName: " & objFWProduct.displayName
  WScript.Echo "enableUIMd5Hash: " & objFWProduct.enableUIMd5Hash
  WScript.Echo "enableUIParameters: " & objFWProduct.enableUIParameters
  WScript.Echo "instanceGuid: " & objFWProduct.instanceGuid
  WScript.Echo "pathToEnableOnUI: " & objFWProduct.pathToEnableOnUI
  WScript.Echo "versionNumber: " & objFWProduct.versionNumber
   Next
    Else
      Err.Clear
  WScript.Echo "Unable to connect to SecurityCenter class on " & strComputer
  WScript.Echo "Number     : " & Err.Number
  WScript.Echo "Source     : " & Err.Source
  WScript.Echo "Description: " & Err.Description
    End If
End Sub

Open in new window

0
Chris DentPowerShell DeveloperCommented:

> C:\scripts\inv.vbs(215, 7) Microsoft VBScript runtime error: Invalid use of Null: 'Join'

I forgot to note...

I removed On Error Resume Next from the beginning of the sub-routine while I was testing and forgot to put it back in. If you want to avoid that error you should be able to add it back and it'll leave you alone :)

Added it back here if you'd like to give it a go?

Chris
Sub NIC_Info

  ' Suppress errors
  On Error Resume Next

  ' Return network adapter information

  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  Set colNICConfig = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")

  For Each objNICConfig in colNICConfig

    WScript.Echo  "----Nic----"
  
    ' Beginning of Adapter specific information
    Wscript.Echo  "Caption    : " & objNICConfig.Caption

    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDefaultIPGateway
      strDefaultIPGateway = Join(objNICConfig.DefaultIPGateway, ",")

      Wscript.Echo "DfltGtwy   : " & strDefaultIPGateway
    End If

    Wscript.Echo "Description: " & objNICConfig.Description
    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDNSDomainSuffixSearchOrder
      strDNSDomainSuffixSearchOrder = Join(objNICConfig.DNSDomainSuffixSearchOrder, ",")

      Wscript.Echo "DNSSrchOrdr: " & strDNSDomainSuffixSearchOrder
    End If

    Wscript.Echo "DHCPEnabled: " & objNICConfig.DHCPEnabled
    Wscript.Echo "MACAddress : " & objNICConfig.MACAddress
    Wscript.Echo "WINSPriSrvr: " & objNICConfig.WINSPrimaryServer
    Wscript.Echo "WINSSecSrvr: " & objNICConfig.WINSSecondaryServer
 
    ' Beginning IP Address Listing
    Dim i
    For i = 0 To UBound (objNICConfig.IPAddress)
      Wscript.Echo "IPAddress  : " & objNICConfig.IPAddress(i)
      Wscript.Echo "Subnet     : " & objNICConfig.IPSubnet(i)
    Next

    Set colNIC = objWMIService.ExecQuery("ASSOCIATORS OF " & _
      "{Win32_NetworkAdapterConfiguration.Index='" & objNICConfig.Index & "'}") ' & _
      ' "WHERE AssocClass=Win32_NetworkAdapterSetting")

    For Each objNIC in colNIC
      Wscript.Echo "LinkSpeed  : " & objNIC.Speed
    Next
  Next
End Sub

Open in new window

0
Rich RumbleSecurity SamuraiAuthor Commented:
Duh... I'm the king of "on error resume next" you'd think I'd of spotted it! Still no linkspeed being echoed. I am able to use this simple script to get the results (see below)
Active: True
InstanceName: WAN Miniport (IP)
NdisLinkSpeed: 288

Active: True
InstanceName: WAN Miniport (IP) - Packet Scheduler Miniport
NdisLinkSpeed: 288

Active: True
InstanceName: VMware Virtual Ethernet Adapter for VMnet1
NdisLinkSpeed: 1000000

Active: True
InstanceName: VMware Virtual Ethernet Adapter for VMnet8
NdisLinkSpeed: 1000000

Active: True
InstanceName: Intel(R) 82566DM-2 Gigabit Network Connection
NdisLinkSpeed: 1000000

Active: True
InstanceName: Intel(R) 82566DM-2 Gigabit Network Connection - Packet Scheduler Miniport
NdisLinkSpeed: 1000000

On Error Resume Next
arrComputers = Array("1.2.3.4")
For Each strComputer In arrComputers
   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM MSNdis_LinkSpeed",,48)
   For Each objItem In colItems
      WScript.Echo "Active: " & objItem.Active
      WScript.Echo "InstanceName: " & objItem.InstanceName
      WScript.Echo "NdisLinkSpeed: " & objItem.NdisLinkSpeed
      WScript.Echo
   Next
Next

Open in new window

0
Chris DentPowerShell DeveloperCommented:

Ah bugger, I found out why...

http://msdn.microsoft.com/en-us/library/aa394216%28VS.85%29.aspx

> Speed
> ...
> Windows Server 2003, Windows XP, Windows 2000, and Windows NT 4.0:  This property has not been implemented yet. It returns a > NULL value by default.

Which is a pain in the backside.

One moment.

Chris
0
Chris DentPowerShell DeveloperCommented:

Try again...

Chris
Sub NIC_Info

  ' Suppress errors
  On Error Resume Next

  ' Return network adapter information

  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  Set colNICConfig = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")

  For Each objNICConfig in colNICConfig

    WScript.Echo  "----Nic----"
  
    ' Beginning of Adapter specific information
    Wscript.Echo  "Caption    : " & objNICConfig.Caption

    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDefaultIPGateway
      strDefaultIPGateway = Join(objNICConfig.DefaultIPGateway, ",")

      Wscript.Echo "DfltGtwy   : " & strDefaultIPGateway
    End If

    Wscript.Echo "Description: " & objNICConfig.Description
    If Not IsNull(objNICConfig.DNSDomainSuffixSearchOrder) Then
      Dim strDNSDomainSuffixSearchOrder
      strDNSDomainSuffixSearchOrder = Join(objNICConfig.DNSDomainSuffixSearchOrder, ",")

      Wscript.Echo "DNSSrchOrdr: " & strDNSDomainSuffixSearchOrder
    End If

    Wscript.Echo "DHCPEnabled: " & objNICConfig.DHCPEnabled
    Wscript.Echo "MACAddress : " & objNICConfig.MACAddress
    Wscript.Echo "WINSPriSrvr: " & objNICConfig.WINSPrimaryServer
    Wscript.Echo "WINSSecSrvr: " & objNICConfig.WINSSecondaryServer
 
    ' Beginning IP Address Listing
    Dim i
    For i = 0 To UBound (objNICConfig.IPAddress)
      Wscript.Echo "IPAddress  : " & objNICConfig.IPAddress(i)
      Wscript.Echo "Subnet     : " & objNICConfig.IPSubnet(i)
    Next

    Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\wmi")
    Set objLinkSpeed = objWMI.Get("MSNdis_LinkSpeed.InstanceName='" & objNICConfig.Description & "'")

    Wscript.Echo "LinkSpeed  : " & objLinkSpeed.NdisLinkSpeed
  Next
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rich RumbleSecurity SamuraiAuthor Commented:
Ding ding ding ding ding! I can't believe how easy the solution is, and how I danced around and around it... sometimes I hate you Chris :)
-rich!
0
Rich RumbleSecurity SamuraiAuthor Commented:
Ahhhhhhhhh!
0
Chris DentPowerShell DeveloperCommented:

I aim to please (when I remember to reply) :)

Chris
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.