Home All Groups Group Topic Archive Search About

Obtain info from other computer

Author
20 Jul 2006 12:06 PM
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.

Author
20 Jul 2006 3:16 PM
Travis Sharpe
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
--------------------------------------------------------------------

XiScO wrote:
Show quoteHide quote
> 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.
Author
21 Jul 2006 8:24 AM
XiScO
I'll try thanks.

Travis Sharpe wrote:

Show quoteHide quote
> 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
> --------------------------------------------------------------------
>
> XiScO wrote:
>> 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.