Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

VB6 And Network Adapter

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Bullseye

Bullseye
  • Members
  • 7 posts
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.


How to remove advertisement from MSFN

#2
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
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 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN