Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Locate MAC from IP with WMI

Reply
 
Old 08-30-2007   #1 (permalink)
Justin Rich


 
 

Locate MAC from IP with WMI

I have an IP and i want to get the assocaited MAC address to it. I'd like to
do this with WMI so i can easily remote to systems but the IP address in any
WMI class is an array. I have the IP as a string.

Thanks
Justin



My System SpecsSystem Spec
Old 08-30-2007   #2 (permalink)
Hal Rottenberg


 
 

Re: Locate MAC from IP with WMI

Justin Rich wrote:
Quote:

> I have an IP and i want to get the assocaited MAC address to it. I'd like to
> do this with WMI so i can easily remote to systems but the IP address in any
> WMI class is an array. I have the IP as a string.
Quick & dirty way, not using WMI:

11# $ipa | % { write-output "$_ $(nbtstat -a $_ |
select-string 'MAC Address')" }
172.16.15.117 MAC Address = 00-50-56-8A-39-18
172.16.15.48 MAC Address = 00-50-56-8A-43-81

As I said, quick & dirty.

--

Hal Rottenberg
blog: http://halr9000.com
powershell category:
http://halr9000.com/article/category...ng/powershell/
My System SpecsSystem Spec
Old 08-30-2007   #3 (permalink)
Shay Levi


 
 

Re: Locate MAC from IP with WMI

You can check http://scriptolog.blogspot.com/2007/...c-address.html
It doesn't retrieve the MAC through WMI but sure can help.
Be sure to check the comment from Jeff which suggests another cool method.

Shay
http://scriptolog.blogspot.com


Quote:

> I have an IP and i want to get the assocaited MAC address to it. I'd
> like to do this with WMI so i can easily remote to systems but the IP
> address in any WMI class is an array. I have the IP as a string.
>
> Thanks
> Justin

My System SpecsSystem Spec
Old 08-30-2007   #4 (permalink)
Hal Rottenberg


 
 

Re: Locate MAC from IP with WMI

Justin Rich wrote:
Quote:

> I have an IP and i want to get the assocaited MAC address to it. I'd like to
> do this with WMI so i can easily remote to systems but the IP address in any
> WMI class is an array. I have the IP as a string.
Try this:

35# $ip = "209.134.176.14"
36# $nac = gwmi Win32_NetworkAdapterConfiguration -comp $ip -filter
"IPEnabled = $true"
37# $nac | Where-Object {$_.IPAddress -contains $ip} | ft
IPAddress,MACAddress

IPAddress MACAddress
--------- ----------
{209.134.176.14} 00:15:C5:53:99:53
{209.134.176.14} 00:15:C5:53:99:53

Notes:
1. gwmi = Get-WmiObject
2. Several diff ways to get your IPs into $ip...ask if you need help on
that.


--

Hal Rottenberg
blog: http://halr9000.com
powershell category:
http://halr9000.com/article/category...ng/powershell/
My System SpecsSystem Spec
Old 08-30-2007   #5 (permalink)
Justin Rich


 
 

Re: Locate MAC from IP with WMI

Thanks for the replies guys...

Because of the way this network runs (no ICMP) a lot of that stuff wont
work... i did however figure this out after some digging...

here is the onliner i came up with.. works well

(gwmi win32_networkadapterconfiguration | where {$_.ipaddress -eq
$theip}).macaddress

Thanks
Justin


"Justin Rich" <jrich523@xxxxxx> wrote in message
news:ui9paYw6HHA.484@xxxxxx
Quote:

>I have an IP and i want to get the assocaited MAC address to it. I'd like
>to do this with WMI so i can easily remote to systems but the IP address in
>any WMI class is an array. I have the IP as a string.
>
> Thanks
> Justin
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Cannot locate printer General Discussion
Issue: Cannot locate the DVD-ROM Gaming
Cant locate a folder Vista file management
COD2, cannot locate cd/dvd-rom Vista Games
Can't locate network Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46