![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | IP to mac address I have a script that get the ip from a computer. The problem is that sice I have vmware installed on some of the computer it gives me more than one ip address. So since the phyical ip address for the machine start with a 10. I have it in the script to look at the first number ---which works fine. My question is how to get the mac address of the 10.x.x.x ip address and not the rest. Here is the script. strcomputer = "." '******************************************* Get IP Address *********************************************** Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set IPConfigSet = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") Set objNetwork = CreateObject("Wscript.Network") For Each IPConfig In IPConfigSet strIPAddress = IPConfig.IPAddress(0) arrIPAddress = Split(strIPAddress, ".") If arrIPAddress(0) = "10" Then wscript.echo IPConfig.IPAddress(0) 'objExcel.Cells(x, 7).Value = IPConfig.IPAddress(0) Else End If Next Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | Re: IP to mac address "freddy" <freddy@xxxxxx> wrote in message news:1A4B9E9A-7E1A-4577-877A-4E63D039E021@xxxxxx Quote: >I have a script that get the ip from a computer. The problem is that sice I > have vmware installed on some of the computer it gives me more than one ip > address. So since the phyical ip address for the machine start with a 10. > I > have it in the script to look at the first number ---which works fine. My > question is how to get the mac address of the 10.x.x.x ip address and > not > the rest. > > Here is the script. > strcomputer = "." > '******************************************* Get IP Address > *********************************************** > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > Set IPConfigSet = objWMIService.ExecQuery _ > ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") > Set objNetwork = CreateObject("Wscript.Network") > For Each IPConfig In IPConfigSet > strIPAddress = IPConfig.IPAddress(0) > arrIPAddress = Split(strIPAddress, ".") > If arrIPAddress(0) = "10" Then > wscript.echo IPConfig.IPAddress(0) > 'objExcel.Cells(x, 7).Value = IPConfig.IPAddress(0) > Else > End If > Next > > Thanks WScript.echo IPConfig.IPAddress(0) to WScript.echo IPConfig.IPAddress(0) & " " & IPConfig.macaddress |
My System Specs![]() |
| | #3 (permalink) |
| | Re: IP to mac address just out of curiosity, I tried it and I got 2 identical lines of output even thought on my xp pc I got only one NIC present. when I run it on a virtual w2k pc I just get one line as expected what could have happened to the the "strange" xp? "Pegasus (MVP)" wrote: Quote: > > "freddy" <freddy@xxxxxx> wrote in message > news:1A4B9E9A-7E1A-4577-877A-4E63D039E021@xxxxxx Quote: > >I have a script that get the ip from a computer. The problem is that sice I > > have vmware installed on some of the computer it gives me more than one ip > > address. So since the phyical ip address for the machine start with a 10. > > I > > have it in the script to look at the first number ---which works fine. My > > question is how to get the mac address of the 10.x.x.x ip address and > > not > > the rest. > > > > Here is the script. > > strcomputer = "." > > '******************************************* Get IP Address > > *********************************************** > > Set objWMIService = GetObject("winmgmts:" _ > > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > > Set IPConfigSet = objWMIService.ExecQuery _ > > ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") > > Set objNetwork = CreateObject("Wscript.Network") > > For Each IPConfig In IPConfigSet > > strIPAddress = IPConfig.IPAddress(0) > > arrIPAddress = Split(strIPAddress, ".") > > If arrIPAddress(0) = "10" Then > > wscript.echo IPConfig.IPAddress(0) > > 'objExcel.Cells(x, 7).Value = IPConfig.IPAddress(0) > > Else > > End If > > Next > > > > Thanks > Change > WScript.echo IPConfig.IPAddress(0) > to > WScript.echo IPConfig.IPAddress(0) & " " & IPConfig.macaddress > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to eliminate invalid e-mail address from address book | Vista mail | |||
| Can i migrate/associate http://mynick.spaces.live.com/ web address with my new email address??? | Live Messenger | |||
| setting for replies: receiver address - not default address | Vista mail | |||
| Help me --Hyper link address.. doesnt take me.. to article (web address) in Window Vista 32 | Vista General | |||