In tip 0835, I built a CSV ( Comma Seperated Values) from Windows NT.

In this script, I use NETDOM, from the Windows 2000 Support folder on the CD-ROM, GetMAC, from the Windows 2000 Server Resource Kit Supplement, and the Packet Inter Net Groper.

The script must run on any Windows 2000 computer, but the 'PDC' might be faster. The domain can be Windows NT, Windows 2000, or Mixed.

The CSV file will be similar to:

JSI001.JSIINC.ORG,,00-50-DA-17-3D-80,\Device\NetBT_Tcpip_\{F651A57B-7286-42BF-A0D4-06C386EC5B77\}                              JSI001.JSIINC.ORG,,00-50-DA-66-2B-16,\Device\NetBT_Tcpip_\{CBFB72DD-10E6-4787-9262-269AA585B530\}                              JSI005,,00-20-E0-61-60-54,\Device\NetBT_Tcpip_\{33CBD362-FDA7-4E37-835A-C6929633A956\}                              JSI007,,00-50-DA-72-47-50,\Device\NetBT_El980n41
JSI001.JSIINC.COM and JSI005                               - are computer names.                     and                               - are IP addresses.                              00-50-DA-17-3D-80 and 00-50-DA-66-2B-16                    - are MAC addresses.                              \Device\NetBT_Tcpip_\{F651A57B-7286-42BF-A0D4-06C386EC5B77\} - is a Transport Name.
NOTE: JSI001 is multi-homed.

The script, MacIpCsv.bat, requires 1 parameter, the output file. MacIpCsv.bat contains:

@echo off                              if \{%1\} EQU \{\} goto syntax                              setlocal                              set outfile=%1                              if exist %outfile% del /q %outfile%                              For /f "Skip=1 Tokens=1" %%i in ('netdom query /domain PDC') do call :computer "%%i"                               For /f "Skip=1 Tokens=1" %%i in ('netdom query /domain DC') do call :computer "%%i"                               For /f "Skip=1 Tokens=1" %%i in ('netdom query /domain SERVER') do call :computer "%%i"                               For /f "Skip=1 Tokens=1" %%i in ('netdom query /domain WORKSTATION') do call :computer "%%i"                               endlocal                              goto end                              :syntax                              @echo Syntax: macipcsv outputfile                              goto end                              :computer                              set machine=%1                              set machine=%machine:"=%                              if "%machine%" EQU "The" goto end                              if "%machine%" EQU "Directory" goto end                              for /f "Skip=1 Tokens=2 Delims=\[\]" %%j in ('ping -n 1 %machine%') do @set ip=%%j                              for /f "Skip=4 Tokens=1,2" %%m in ('getmac \\%machine%') do @if "%%m" NEQ "00-00-00-00-00-00" @echo %machine%,%ip%,%%m,%%n>>%outfile%                              :end