 |
How do I build
and maintain a list of Computer Names, IP Addresses, and MAC
Addresses for my domain? |
 |
How do I build and maintain a list of Computer Names, IP Addresses, and
MAC Addresses for my domain?
|
|
If you wish to create a CSV (Comma Separated Value) file that contains
Computer Name, IP Address, and MAC Address similar to:
JSI001, 23.15.1.10, 00-10-AC-30-1E-34
JSI002, 23.15.1.20, 00-10-AC-31-84-06
JSI003, 23.15.1.30, 00-10-AC-27-34-18
you can use the IPCONFIG /ALL command. The output of this command
provides the following information:
Windows NT IP Configuration
Host Name . . . . . . . . . : JSI001.JSI
DNS Servers . . . . . . . . :
Node Type . . . . . . . . . : Mixed
NetBIOS Scope ID. . . . . . :
IP Routing Enabled. . . . . : No
WINS Proxy Enabled. . . . . : No
NetBIOS Resolution Uses DNS : No
Ethernet adapter Elnk31:
Description . . . . . . . . : ELNK3 Ethernet Adapter.
Physical Address. . . . . . : 00-10-AC-30-1E-34
DHCP Enabled. . . . . . . . : No
IP Address. . . . . . . . . : 23.15.1.10
Subnet Mask . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . : 23.15.1.10
Ethernet adapter NdisWan4:
Description . . . . . . . . : NdisWan Adapter
Physical Address. . . . . . : 00-00-00-00-00-00
DHCP Enabled. . . . . . . . : No
IP Address. . . . . . . . . : 0.0.0.0
Subnet Mask . . . . . . . . : 0.0.0.0
Default Gateway . . . . . . :
Primary WINS Server . . . . : 23.15.1.10
The IPCONFIG /ALL command must run locally. If you pipe the output to a
consistent location on each computer, you can retrieve, parse, and
combine it.
There are a number of ways to accomplishing this, including scheduling
the IPCONFIG /ALL command, placing it in a logon script, or including it
in AUTOEXNT.BAT. I use the later method and pipe the output to C:\Admin\IPConfig.log
on each server and workstation in my domain.
When I want an updated CSV, I run JSIipMAC.bat which has 3 required
parameters:
1. The full path of the CSV file you want generated.
2. The full path to a file that contains computer names in my domain.
See tip 677.
3. The ShareName\[folder]\IPConfig.log on each computer.
Examples:
JSIipMAC "<Drive:>:\folder1\JSIipMAC.CSV" "<Drive:>:\folder2\JSI Domain
Members.DAT" "AdminShare\IPConfig.log"
JSIipMAC C:\folder1\JSIipMAC.CSV "\\Server\Share\JSI Domain Members.DAT"
"C$\Admin\IPConfig.log"
Note: The quotes are only needed if the path has spaces.
JSIipMAC.bat contains:
@echo off
setlocal
If %1=="" goto syntax
if %2=="" goto syntax
if %3=="" goto syntax
if not exist %2 goto syntax
if exist %1 del /q %1
set rpt=%1
set comp=%2
set cfgpath=%3
set cfgpath=%cfgpath:"=%
for /f %%i in ('type %comp%') do call :machine %%i
endlocal
goto end
:Syntax
@echo Syntax: JSIipmac "Drive:\Path\UserRpt.txt" "Drive:\Path\Computer.txt"
"ShareName\[path]\iplog.log"
endlocal
goto end
:machine
if not exist "\\%1\%cfgpath%" goto end
for /f "Tokens=1* Delims=:" %%i in ('type "\\%1\%cfgpath%"') do call :ipc
%1 "%%i" "%%j"
goto end
:ipc
set test=%2
if %test%=="" goto end
set test=%test: =%
set test="%test:~2,99%
if /i %test%=="PhysicalAddress......" goto mac
if /i %test%=="IPAddress........." goto ip
goto end
:mac
set macadd=%3
goto end
:ip
set ipadd=%3
set ipadd="%ipadd:~2,99%
if %ipadd%=="0.0.0.0" goto end
set macadd=%macadd:~2,99%
set ipadd=%ipadd:"=%
set macadd=%macadd:"=%
@echo %1,%ipadd%,%macadd% >> %rpt%
:end
Since we get a lot of donated Step
x Step, White Papers and Faq's please let us know if they contain errors
by emailing us
here.
| |
Search
or Choose a Link from the top of this page. |
 |
| |
Search
or Choose a Link from the top of this page. |
 |
| |
|
|
|
 |

Webmasters, please don't throw away
your old whitepapers or Faq's or let them fade away, we would be
more than happy to host them here on our site, even if they are
antiquated and outdated! |
|
|


 |
It is Still Free! |
 |
|
Speed up your Computer!
Get FREE
Anti Virus (Norton) & Anti Spyware Apps (Spyware
Doctor)
for your PC. |
|
Install Google Pack now!
Then Sweep it for Viruses, Malware & SpyWare!
|
|
|
 |
Google Info box |
 |
|
|
|