[itdiscuss] Name/IP lookup

Danny Ybarra dannyy at viantsolutions.com
Thu Apr 2 16:57:04 EDT 2009


Not the cleanest code.
Also Disclaimer (I just took a Vicadin) just had surgery on my hand.

Change this line below if you want to save to file
@echo %%a %%c)

To

@echo %%a %%c > filename.txt)





GetIP.bat
--------------------------------------------
@echo off

setlocal
set dom=%1
if defined USERDNSDOMAIN if not defined dom set dom=%USERDOMAIN%
if not defined dom goto :err1
for /f "Tokens=1 delims=^\," %%g in ('net view /domain:%dom% ^|Findstr /L /C:"\\"') do (
 for /f "Tokens=1" %%a in ('@echo %%g') do (
 FOR /F "tokens=2,3 delims= " %%b IN ('PING -n 1 %%a ^| find "Reply"') DO (
@echo %%a %%c)
)
)
endlocal
goto :EOF
:err1
@echo NetViewC - a NetBIOS domain name parameter is required because you are logged on locally to %USERDOMAIN%.
endlocal












Danny Ybarra
Viant Solutions
678-358-4603

From: discuss-bounces at itdiscuss.org [mailto:discuss-bounces at itdiscuss.org] On Behalf Of Tony Dye
Sent: Thursday, April 02, 2009 4:11 PM
To: Discuss
Subject: [itdiscuss] Name/IP lookup

I'm sure I used to know how to do this, and now my mind is blank.  (yeah, go ahead and insert your insult/joke here).  I can do a
                net view /DOMAIN:name
to get a list of all the machines (at least the Windows one) on a network.

What's an easy way to get the IP addresses to go with that list.  Caveat, have to work in Windows, no *nix system available.  Also unwilling to pay for a utility for this.

Any easy answers?



--
Tony Dye
Blog: http://tonydye.net<http://tonydye.net/>
Find me on LinkedIn: http://www.linkedin.com/in/tonydyev2<http://www.linkedin.com/in/tonydyeit>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://optimus.thompsonic.com/pipermail/discuss/attachments/20090402/93f022f8/attachment.htm 


More information about the discuss mailing list