• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
Sign in to follow this  
Followers 0
Bullseye

VB6 And Network Adapter

2 posts in this topic

Trying to use WMI to read the following for the default network adapter ..

Connection Name

NIC Model

NIC MAC

NIC I.P

Connected Speed

Any help appreciated.

0

Share this post


Link to post
Share on other sites

Try this VBS Script.

Option Explicit 
Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\CIMV2")
Dim Adapter, ColItems, Card, IP, Ip1, Ip2, NetMadeBy, ObjItem, Report
Set ColItems = Wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration",,48)
For Each ObjItem in ColItems
If isNull(ObjItem.IPAddress) Then
Else
NetMadeBy = Split(ObjItem.Description," ")
Card = Len(NetMadeBy(0))
Report = Report & "Caption " & vbTab & ObjItem.Description & vbCrLf
Ip = Join(ObjItem.IPAddress, ",")
Ip1 = Split(IP,",")
For Each Ip2 in Ip1
Report = Report & "IPAddress " & vbTab & Ip2 & vbCrLf
Adapter_Info1()
Exit For
Next
End If
Next
Function Adapter_Info1()
Dim ColNet, M1, NetItem
Set ColNet = Wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapter",,48)
For Each NetItem in ColNet
If Instr(Lcase(NetItem.Manufacturer),LCase("Microsoft")) Then
Else
M1 = Left(NetItem.Manufacturer,Card)
M1 = M1
If InStr(NetMadeBy(0),M1) Then
Report = Report &_
"Manufacturer" & vbTab & NetItem.Manufacturer & vbCrLf & _
"Speed " & vbTab & FormatNumber(NetItem.Speed) & vbCrLf & _
"MACAddress " & vbTab & NetItem.MACAddress & vbCrLf
End If
End If
Next
End Function
WScript.Echo Report

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.