• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

Get ip address and Mac address from machines when switched off also.

Hi,

Get ip address and Mac address from machines when switched off also.
I have the below solution from AmazingTech

FOR /f %a in (machine.lst) do FOR /f "tokens=2 delims=[]" %%b in ('ping -n 1 -w 100 %%a ^| find /i "pinging"') do echo %%a,%%b>>MachineIP.CSV

I need a option of getting the Mac  address also in the next colum along with ip address.

Regards
Sharath

0
bsharath
Asked:
bsharath
  • 10
  • 6
1 Solution
 
AmazingTechCommented:
If you have WINS we can get the MAC from there only if the machine is on.
0
 
AmazingTechCommented:
MAC will be blank if the machine is off.
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /f %%a in (machine.lst) do FOR /f "tokens=2 delims=[]" %%b in ('ping -n 1 -w 100 %%a ^| find /i "pinging"') do (
    SET MAC=
    FOR /f "Tokens=3 Delims== " %%c in ('nbtstat -a %%a ^| find /i "MAC Address"') DO SET MAC=%%c
    echo %%a,%%b,!MAC!>>MachineIPMAC.CSV
)

Open in new window

0
 
bsharathAuthor Commented:
AT cant we get the Mac if the machine is OFf from the DHCP servers
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
bsharathAuthor Commented:
AT cant we get the Mac if the machine is OFf from the DHCP servers
0
 
AmazingTechCommented:
Hmm... What DHCP service are you using? CISCO? MS Server 2003? Something else?
0
 
bsharathAuthor Commented:
Windows 2003 Server
0
 
bsharathAuthor Commented:
Windows 2003 Server
0
 
bsharathAuthor Commented:
Hi AT any views...
0
 
AmazingTechCommented:
Sorry I don't have Windows DHCP. I was going to spin one up but just haven't had the chance yet. Maybe if you could do a dump and post the file up here I can work with the output.

Please mask any personalized info. Like MAC address might show up as 08:02:21:AE:0E:88 change it to XX:XX:XX:XX:XX:XX

Keep the formatting the same I don't need to see your specific info.

netsh dhcp server {ServerName} dump > DHCPDUMP.TXT
netsh dhcp server {ServerName} show > DHCPSHOW.TXT
0
 
bsharathAuthor Commented:
AT
Is there any specific data you need from this output. As this is a very long output that comes out...
0
 
bsharathAuthor Commented:
AT
Is there any specific data you need from this output. As this is a very long output that comes out...
0
 
AmazingTechCommented:
Just need to know where MAC addresses are positioned in the file and all the other lines before and after so I can see how to get just the info you want. A couple computers will do.
0
 
bsharathAuthor Commented:
Hi AT sorry for the delay i getting back

This command gets some data and just the reservations details
netsh dhcp server {ServerName} dump > DHCPDUMP.TXT

This command does not get anything i tried with show all and get just the stats of how many ip's are there how many free etc
netsh dhcp server {ServerName} show > DHCPSHOW.TXT
0
 
bsharathAuthor Commented:
Hi AT sorry for the delay i getting back

This command gets some data and just the reservations details
netsh dhcp server {ServerName} dump > DHCPDUMP.TXT

This command does not get anything i tried with show all and get just the stats of how many ip's are there how many free etc
netsh dhcp server {ServerName} show > DHCPSHOW.TXT
0
 
AmazingTechCommented:
Hmm... I believe these commands are from one of tigermatt's solutions to you. Unfortunately I can't run them here. So there are no MAC addresses in these dumps?
0
 
bsharathAuthor Commented:
There are but not of leased ip's but of just reserved ip's
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 10
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now