I've wrote a handy batch file that painlessly generates the WOL.dat file for you. I borrowed a big chunk of the code from Rob van der Woude of www.robvanderwoude.com

Right now the process writes to c:\WOL.dat, just change that to where you would like the dat file to be stored. This process checks for the computer name in WOL.dat, and removes it's line from the file if it is found. This makes it easy to update a computer's mac address in event of name change or a new NIC. It also pings for the computer before it does makes any changes to the dat file. If the computer isn't found, nothing is changed. Anyways.. have fun with it, hope it helps some of you.


Just make a .bat file with this as its contents, and make a new Hyena tool that calls newBatFile.bat %e%
<div class="ubbcode-block"><div class="ubbcode-header">Quote:</div><div class="ubbcode-body"><div class="ubbcode-block"><div class="ubbcode-header">Code:</div><div class="ubbcode-body ubbcode-pre" ><pre>
@ECHO OFF
:: Check OS version
IF NOT &quot;%OS%&quot;==&quot;Windows_NT&quot; GOTO Syntax

SETLOCAL ENABLEEXTENSIONS

:: Check command line arguments
IF NOT &quot;%~2&quot;==&quot;&quot; GOTO Syntax
ECHO.%1 | FINDSTR /R /C:&quot;[/?*]&quot; &gt;NUL &amp;&amp; GOTO Syntax

:: Checks for user variable, if it exists it is set as the computer name, if it doesn't
:: The default is to run the script locally.
IF &quot;%~1&quot;==&quot;&quot; (SET Computer=%ComputerName%) ELSE (SET Computer=%~1)

:: Checks for the computer in the error log, removes if it is found.
:: Comment out or delete the next four lines if you do not want
:: information removed from the log.
find /i /v &quot;%Computer%&quot; &lt; &quot;C:\WOLErrors.log&quot; &gt; &quot;C:\tmp.log&quot;
Ren &quot;C:\WOLErrors.log&quot; WOLErrors.tmp
Ren &quot;C:\tmp.log&quot; WOLErrors.log
del &quot;C:\WOLErrors.tmp&quot;

:: Checks if you are looking up the computer you are on,
:: This skips the ping and NSLookup.
IF /I &quot;%Computer%&quot; == &quot;%ComputerName%&quot; GOTO Lookup

:: Checks that the computer can be pinged within 10ms,
:: increase this if you have a slower network.
:: Also saves the computer's IP Address so the computer
:: name can be confirmed.

:Confirmations
FOR /F &quot;skip=3 tokens=1,3 delims= &quot; %%A IN ('ping %Computer% -n 1 -w 10') DO IF &quot;%%A&quot; == &quot;Reply&quot; (
SET IPAddress=%%B) ELSE IF &quot;%%A&quot;==&quot;Request&quot; (GOTO Timeout)

:: Removes the colon from the end of the retrieved string.
set IPAddress=%IPAddress::=%
ECHO.
ECHO %IPAddress% responded to Ping.

:: Retrieves the computer name using NSLookup and compares
:: it to the supplied computer name. Throws error if the names
:: do not match. This is usefull if the computer has
:: not been turned on long enough for the DNS server to reassign
:: its IP Address.
For /F &quot;tokens=1,2 delims=. &quot; %%A IN ('nslookup %IPAddress%') DO IF &quot;%%A&quot; == &quot;Name:&quot; (Set NSName=%%B)
IF /I &quot;%NSNAME%&quot; NEQ &quot;%Computer%&quot; GOTO Mismatch
ECHO %NSNAME% responded to NSLookup.

:: The actual command is a one-liner, be it a long one.
:: If the batch file is intended for use on local computers only,
:: use IPCONFIG /ALL instead of NBTSTAT -a %Computer%

:Lookup
FOR /F &quot;tokens=*&quot; %%A IN ('NBTSTAT -a %Computer% 2^&gt;NUL ^| FINDSTR /R /I /C:&quot;[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]&quot;') DO FOR %%B IN (%%A) DO SET MACAddress=%%B
IF &quot;%MACAddress%&quot;==&quot;&quot; GOTO NbstatError

:: Checks for the computer in the .dat file, removes if it is found.
find /i /v &quot;%Computer%&quot; &lt; &quot;C:\WOL.dat&quot; &gt; &quot;C:\tmp.dat&quot;
Ren &quot;C:\WOL.dat&quot; WOL.tmp
Ren &quot;C:\tmp.dat&quot; WOL.dat
del &quot;C:\WOL.tmp&quot;

:: Show result and exit
ECHO.
ECHO.
ECHO ****************************************
ECHO %Computer% %MACAddress%
ECHO %Computer% %MACAddress%&gt;&gt; &quot;C:\WOL.dat&quot;
ECHO.
ECHO WOL.dat has successfully been updated!
ECHO ****************************************
ENDLOCAL &amp; SET MACAddress=%MACAddress%
sleep 1
GOTO End

:Timeout
ECHO.
ECHO //////////////////
Echo Request timed out.
ECHO //////////////////
ECHO.
FOR /F &quot;TOKENS=1* DELIMS= &quot; %%A IN ('DATE/T') DO SET Today=%%B
FOR /F &quot;TOKENS=*&quot; %%A IN ('TIME/T') DO SET Now=%%A
ECHO %Computer% Timed Out on %Today% at %Now%. &gt;&gt; &quot;C:\WOLErrors.log&quot;
sleep 1
GOTO End

:NbstatError
ECHO.
ECHO ////////////////////////
Echo Nbstat could not connect
ECHO ////////////////////////
ECHO.
FOR /F &quot;TOKENS=1* DELIMS= &quot; %%A IN ('DATE/T') DO SET Today=%%B
FOR /F &quot;TOKENS=*&quot; %%A IN ('TIME/T') DO SET Now=%%A
ECHO %Computer% NBSTAT Connection Error on %Today% at %Now%. &gt;&gt; &quot;C:\WOLErrors.log&quot;
sleep 1
GOTO End

:Mismatch
Echo.
ECHO///////////////////////////
ECHO NSLookup returned %NSName%
ECHO///////////////////////////
ECHO.
FOR /F &quot;TOKENS=1* DELIMS= &quot; %%A IN ('DATE/T') DO SET Today=%%B
FOR /F &quot;TOKENS=*&quot; %%A IN ('TIME/T') DO SET Now=%%A
ECHO %Computer% NSLookup Match Error on %Today% at %Now%. %IPAddress% returned %NSName% &gt;&gt; &quot;C:\WOLErrors.log&quot;
sleep 1
GOTO End
:Syntax
ECHO.
ECHO GetMacXP.bat, Version 1.00 for Windows NT 4 and later
ECHO Show the MAC address for any computer in the workgroup or domain
ECHO.
ECHO Usage: GETMACXP [ computer ]
ECHO.
ECHO Where: &quot;computer&quot; is the name of the computer we want to know the
ECHO MAC address of (default is the local computer)
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO Massively changed for use with Hyena by Falyst
pause
IF &quot;%OS%&quot;==&quot;Windows_NT&quot; ENDLOCAL

:End

</pre></div></div></div></div>

edit: added some checks for when nbstat does not find a mac address..

[This message has been edited by Falyst (edited 08-05-2008).]

edit: Added a nslookup check to confirm the computer name and IP correspond with each other. I also made the log only have one entry per computer, to help keep track of which computers need to be updated. Also added checks to work better when updating the same computer the script is running from.

Hopefully there will be no more updates..

[This message has been edited by Falyst (edited 08-06-2008).]