[Win32utils-devel] hostid on Windows Vista and later
Park Heesob
phasis at gmail.com
Sat Jun 21 23:34:27 EDT 2008
Hi,
----- Original Message -----
From: "Daniel Berger" <djberg96 at gmail.com>
To: "Development and ideas for win32utils projects"
<win32utils-devel at rubyforge.org>
Sent: Sunday, June 22, 2008 10:49 AM
Subject: [Win32utils-devel] hostid on Windows Vista and later
> Hi all,
>
> According to my research, the equivalent of gethostid() on Windows is the
> IPXAddress member of the Win32_NetworkAdapterConfiguration class. You can
> see the equivalent if you type "ipconfig /all" and look at the "Physical
> Address" member.
>
> However, the MSDN docs say that the IPXAddress member is no longer valid
> on Windows Vista and later. Does anyone know how to get the hostid on
> Vista and later?
>
Why do you need IPXAddress member? As I know, the IPX protocol is not
installed by default on XP and 2003.
In my test IPXAdress is just same to MACAddress and MACAddress member works
on Vista.
Following script works on XP, 2003 and Vista:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_NetworkAdapterConfiguration where
IPEnabled=true",,48)
For Each objItem in colItems
Wscript.Echo "MACAddress: " & objItem.MACAddress
Next
Regards,
Park Heesob
More information about the win32utils-devel
mailing list