Question
When logging is turned on in automation and the log file is saved to the network drive, all of the clients log to the same aclient.log. Is there a way to save the aclient log with a unique filename in automation?
Answer
The following steps will add the client's IP address to the name of the log file created while in automation.
--------------------------------------------------------------------------------------------------
@echo off
set temp_i=default
for /f "tokens=1,2 delims=:" %%i in ('ipconfig') do call:setname "%%i" "%%j"
echo your IP is %IP_ADDR%
set LogName=M:\\temp\\%IP_ADDR%-WinPE_aclient.log
echo Windows Registry Editor Version 5.00 >> %_work%\temp.reg
echo >> %_work%\temp.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Client Service] >> %_work%\temp.reg
echo "InstallDir"="%_work%\" >> %_work%\temp.reg
echo "LogFile"=dword:00000001 >> %_work%\temp.reg
echo "LogFilename"="%LogName%" >> %_work%\temp.reg
echo "LogInformation"=dword:00000001 >> %_work%\temp.reg
echo "LogErrors"=dword:00000001 >> %_work%\temp.reg
echo "LogDebug"=dword:00000001 >> %_work%\temp.reg
echo "LogSize"=dword:00064000 >> %_work%\temp.reg
if not exist %_work%\aclient.inp copy x:\aclient.inp %_work%\
set _Agent_cfgpath=%_work%\
echo LogFile=%LogName% >> %_work%\aclient.inp
echo LogSize=409600 >> %_work%\aclient.inp
echo LogErrors=Yes >> %_work%\aclient.inp
echo LogInformation=Yes >> %_work%\aclient.inp
echo LogDebug=Yes >> %_work%\aclient.inp
regedit /s %_work%\temp.reg
goto:eof
:setname
if NOT %1=="" set temp_i=%~1
set temp_j=%~2
set temp_j=%temp_j: =%
set temp_i=%temp_i:~3,2%
if "%temp_i%"=="IP" set IP_ADDR=%temp_j%
goto:eof
--------------------------------------------------------------------------------------------------
Now build the WinPE configuration. The AClient will log to M:\temp\<ip_addr>-WinPE_aclient.log.
This batch file has been added to the KB for convenience. Just select Add File on step 3 instead of New File.
Note: WinPE must have a Z: drive (RAMDRIVE) available for this script to work properly. This requirement is only applicable to WinPE automation partitions and boot CDs; PXE WinPE always has the RAMDRIVE available.
Note: These settings will NOT overwrite the settings already in the aclient.inp file. You must have a semicolon in front of LogFile= in the aclient.inp for this to work properly.
Note: To change the unique ID in this batch file from ip address to mac address change the following lines
for /f "tokens=1,2 delims=:" %%i in ('ipconfig') do call:setname "%%i" "%%j"
to:
for /f "tokens=1,2 delims=:" %%i in ('ipconfig /all') do call:setname "%%i" "%%j"
if "%temp_i%"=="IP" set IP_ADDR=%temp_j%
to: (note this one is case sensitive)
if "%temp_i%"=="Ph" set IP_ADDR=%temp_j%