Computer Hope

Microsoft => Microsoft DOS => Topic started by: zodehala on February 03, 2012, 09:19:18 AM

Title: all mac in LAN
Post by: zodehala on February 03, 2012, 09:19:18 AM
we have 2 workgroup in win network (workgroup and callcenter)

first of all i am listing pc using net view /domain:workgroup and  net view /domain:callcenter

and ping it to find ip and MAC

callcenter pc name is like

\\Agent-1
\\Agent-2
..
..
\\Agent-100

i can find a pc MAC  usign this command nbtstat -a Agent-1

1- how can i find all pc mac usign just one command ?
2- i can print it into text file like command > c:\conf.txt. how can i do it for all pc at one time
Title: Re: all mac in LAN
Post by: Raven19528 on February 03, 2012, 10:36:43 AM
Try this short piece of code:
Code: [Select]
@echo off
setlocal enabledelayedexpansion

for /f "delims=" %%A in ('net view /domain:workgroup') do (
  set comp=%%A
  set comp=!comp:~2!
  nbtstat -a !comp! >>MAC.txt
)

If you are wanting to have a specific output that is maybe only one or two lines per entry, it will require some additional work, so let us know if that is what you are wanting.
Title: Re: all mac in LAN
Post by: zodehala on February 04, 2012, 02:47:03 AM
first of all

fetching mac all pc in workgroup in one go
Title: Re: all mac in LAN
Post by: Raven19528 on February 06, 2012, 02:29:43 PM
first of all

fetching mac all pc in workgroup in one go
Ummm... What?