Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch File / Logon Script assistance

Status
Not open for further replies.

mlc9

MIS
Aug 15, 2007
255
US
I am not all that good at writing batch files. I know, it should be simple. Having said that, can someone please help me with a batch file addition? Our current logon script just simply maps network drives.

What I would like to do is add lines that would gather the wireless MAC addresses of users. Ideally, I guess I'd like for the logon script to run ipconfig /all at logon, and then write that info to an ongoing text file on a network share somewhere. If I could filter the script down to just a computer domain name and wireless MAC address that would be nice. Ultimately, I could then just take the text file output and collate from there.

Can anybody help with what would go in the batch file? Thanks
 
Do you own the access point? How would you know which adapter? If you own the WAP and know the IP range...

you could do arp -a, and filter for the IP on the subnet of the WAP

c:>arp -a

Interface: 192.168.1.5 --- 0x20002
....

Ok. No I know the that my DHCP range for my WAP is 192.168.1/24, so the IP I want is 192.168.1.5. Now, Nbtstat -A

c:>nbtstat -A 192.168.1.5

Wireless Network Connection:

Node IpAddress: [192.168.1.5] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
MYLAPTOP <00> UNIQUE Registered
MYLAPTOP <20> UNIQUE Registered
DOMAIN <00> GROUP Registered
..__MSBROWSE__.<01> GROUP Registered

MAC Address = 00-19-D2-68-0D-0A

Then filter the line with the MAC. You also have the domain name in the output if you want it (it's the <00> record).

So now let's put it together:

create a batch file doarp.bat that contains

arp -a | find "Interface: 192.168.1"



Now,


for /f "tokens=1-3 delims= " %i in ('doarp.bat') do nbtstat -A %j | find "MAC Address"

That gives you the MAC address for the IP.


XMSRE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top