Deployment Solution

 View Only

How to Get Aclient or Dagent to Log to Unique File Names in Automation 

Feb 10, 2009 06:27 PM

When troubleshooting Aclient issues in automation there are cases where a problem only duplicated when multiple aclients are connected during automation. By default the Aclient can only log to a static log file name. This can cause confusion and make a log relatively useless when two or more Aclients are logging to the same log file. To resolve this issue I have put together a batch file that can be included with the WinPE boot to set the log file name to include a unique identifier of either the IP address or MAC address.

Description

This batch file will use the output of ipconfig and parse for the IP address or MAC address then modify the registry in automation and the aclient.inp before the agent loads to give the agents a unique log file.

Note: This also makes the automation aclient log complete with initialization info and inventory info like in production.

Step 1: Modify / Create the WinPE boot

Modify / Create the WinPE boot you would like to enable unique log files on. For PXE boot options you will need to go through the PXE configuration utility. Otherwise open Boot Disk Creator.

Go to the edit configuration screen

Note: If this is a new configuration you will need to go through and setup the initial configuration steps to get here.

Step 2: Add the batch file

Right click the startup folder and select new > text file. Name the text file with the .bat extension, for example LogFileChange.bat. Copy in the following contents:

@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=f:\\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

Step 3: Configure the Batch file

It is recommended that you go through the batch file and set the settings here you would like to use for logging.

Note: that these settings will NOT overwrite the settings that are put in the aclient.inp file. You need to have a semi-colon in front of LogFile= in the aclient.inp or the Aclient will not pick up the changes made by this batch file.

Items of interest are going to be the log file name and the log file size (if you need it larger than 400k). The %IP_ADDR% is the system variable that is set in the batch file.

To alter the log to use MAC address instead of the IP address in the log file name 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" 

echo your IP is %IP_ADDR%
to
echo your MAC is %IP_ADDR%

if "%temp_i%"=="IP" set IP_ADDR=%temp_j%
to
if "%temp_i%"=="Ph" set IP_ADDR=%temp_j%

Note: the Ph is case sensitive

This will then set the IP_ADDR variable to the MAC address of the machine instead of the IP address.

Step 4: Build WinPE

Click next and continue to build WinPE as normal. When clients boot up they will log to the directory specified in the batch file above.

Requirements:

  • There must be a RAMDRIVE setup (z: winpe 1.6) for the WinPE configuration. By default this is on for all PXE and Automation partition WinPE boots. For WinPE boot CDs the user must select the "Boot into ramdisk" option when building the CD
  • Aclient.inp has a semi-colon in front of LogFile=

Statistics
0 Favorited
0 Views
2 Files
0 Shares
0 Downloads
Attachment(s)
jpg file
11891.jpg   2 KB   1 version
Uploaded - Feb 25, 2020
jpg file
BDC_1_2_0.jpg   10 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Oct 14, 2010 03:26 AM

In case anyone finds this (extremely helpful) article, but is running the newer WinPE v2.1 automation boot disk, you need to tweak a few things to get it to work.

I decided to make my own article. Have a look here:

https://www-secure.symantec.com/connect/articles/how-enable-unique-name-logging-dagent-winpe-21

Aug 12, 2010 02:40 PM


I am seeing the portion that says Your IP is <IP Address> however it is not echoing any of the other items and is not creating the log file in F:\Temp (express share\temp).

I am using WinPE 2.1 is there a reason this would not work in there as well?  I know the instructions are for WinPE 1.6.




Related Entries and Links

No Related Resource entered.