Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- From: RD <rdelaugerre@xxxxxxxxx>
- Date: Wed, 4 Jun 2008 12:25:58 -0700 (PDT)
On Jun 4, 5:40 pm, "Spin" <S...@xxxxxxxxxxx> wrote:
"RD" <rdelauge...@xxxxxxxxx> wrote in message
news:76faf4d4-d409-4f98-bc21-a9ef3c8ad05d@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It's a simple WQL request (SQL like for WMI) to list all instances of
Win32_NetworkAdapter class
then, for each of the results, it prints the MACAddress property.
So it's all WMI, works on any remote computer provided you have the
proper user rights (that is admin) on the account that runs the
script.
If you want to logon as another user, google or msdn search for
Management.ManagementScope (I use that in VB.NET)
It definitely worked. It picked up the remote MAC address of the machine
for which I intended it. It also picked up some other MAC addresses as well
which was kind of weird.
What I did was alter line 1 of the script changing it to:
strComputer = "DC1"
which resulted in it displaying the MAC of machine DC1 (DC1 has only 1 NIC,
no other NICs present at all). However the script also displayed a MAC of
50:50:54:50:30:30. Kinda weird, huh?
I know. tested it on two computers (both running win xp pro, both with
only one NIC) and on both it reports 10+ instances, with 3 differant
mac addresses.. I don't know what the others are though..
So to be sure, you can change the request to "SELECT * FROM
Win32_NetworkAdapter WHERE DeviceID=1"
If I remember correctly the mac address of the first device listed is
the good one.
Glad it helped.
.
- Follow-Ups:
- References:
- How can I obtain the MAC address of a remote machine via a WMI Script?
- From: Spin
- Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- From: RD
- Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- From: Spin
- Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- From: RD
- Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- From: Spin
- How can I obtain the MAC address of a remote machine via a WMI Script?
- Prev by Date: Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- Next by Date: MTP Protocol
- Previous by thread: Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- Next by thread: Re: How can I obtain the MAC address of a remote machine via a WMI Script?
- Index(es):
Relevant Pages
|