Obtain info from other computer

  • Thread starter Thread starter XiScO
  • Start date Start date
X

XiScO

hi!
I'm trying to get some info from other computers, I make ping to test that
are powered on, then want to get netbios name and MAC. I get the dns name
and get only first part as netbios (although this may be wrong,right?).
Is there anyway to get netbios and mac of other computer?
Thanks.
 
You could use WMI to collect the information you want from a remote
machine. Look at the System.Management classes, and the
Win32_NetworkAdapterConfiguration WMI class.

Here's an example of a VBScript that does something simliar, it's not
too difficult to port this to VB.NET with the classes in System.Managment

---------------------------------------------------------
On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

strComputer = INputbox("Enter an IP address or ComputerName")

WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "DatabasePath: " & objItem.DatabasePath
WScript.Echo "Description: " & objItem.Description
WScript.Echo "DNSDomain: " & objItem.DNSDomain
WScript.Echo "DNSHostName: " & objItem.DNSHostName
strIPAddress = Join(objItem.IPAddress, ",")
WScript.Echo "IPAddress: " & strIPAddress
WScript.Echo "MACAddress: " & objItem.MACAddress
WScript.Echo "TcpipNetbiosOptions: " & objItem.TcpipNetbiosOptions
Wscript.echo "----------------------------------------------------"
Next
 
I'll try thanks.

Travis said:
You could use WMI to collect the information you want from a remote
machine. Look at the System.Management classes, and the
Win32_NetworkAdapterConfiguration WMI class.

Here's an example of a VBScript that does something simliar, it's not
too difficult to port this to VB.NET with the classes in System.Managment

---------------------------------------------------------
On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

strComputer = INputbox("Enter an IP address or ComputerName")

WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "DatabasePath: " & objItem.DatabasePath
WScript.Echo "Description: " & objItem.Description
WScript.Echo "DNSDomain: " & objItem.DNSDomain
WScript.Echo "DNSHostName: " & objItem.DNSHostName
strIPAddress = Join(objItem.IPAddress, ",")
WScript.Echo "IPAddress: " & strIPAddress
WScript.Echo "MACAddress: " & objItem.MACAddress
WScript.Echo "TcpipNetbiosOptions: " & objItem.TcpipNetbiosOptions
Wscript.echo "----------------------------------------------------"
Next
 
Back
Top