Deployment Solution

 View Only

How To: Enable Unique Name Logging for DAgent in WinPE 2.1 

Oct 14, 2010 03:43 PM

First off, a big thank you to "Greeneye" for the fantastic article regarding unique Aclient logging within WinPE 1.6. You can see that article here:

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

This article also follows on from the official Symantec "How To" articles as follows;

How To: Log and Troubleshoot Axengine/AClient/Console/PXE communications (HOWTO9302)

How do I enable AClient or DAgent logging in WinPE PXE Automation? (HOWTO3066)

------------------------------------------------------

I recently had to log some automation details for Symantec Technical Support, and needed to find a way to enable logging within our WinPE v2.1 automation boot disk messages as well (which is not covered in "HOWTO9302" above). I haven't needed to do this for some time, and in fact used the instructions from the "Greeneye" article to enable logging within our older WinPE v1.6 automation environment - but unfortunately it's not quite the same for the new version.

First of all, I need to point out one important thing: A WinPE boot disk can be configured to produce a log file in a really easy way. You simply edit your boot disk in the "Boot Disk Creator", find your way to the "Configuration" screen, click on the "aclient.inp" file, and uncomment the log options. This process is covered in more detail in the "HOWTO3066" article above. The problem with this process, is that every single computer booted to automation will try to connect to this one file, will erase the previous contents of the log file. This is a problem for logging multiple computers, particularly when diagnosing multicast communication issues, etc. Making matters worse, the "Aclient.inp" does NOT support variables. Trying to change the log path to "%ID%" or other tokens (or environment variables) simply does not work.

And that brings me to the "how to" part of this article. Between WinPE v1.6 and v2.1, there have been a few subtle changes to the ways things are done. Most notably, the automation agent changing from "Aclient" to "DAgent". The issue with the "Greeneye" article, and the reason it no longer works, is due to Altiris repurposing (and/or renaming) a couple of the registry keys that are required to make the import work. "Registry?" I hear you ask. Yes, due to the "Aclient.inp" file not accepting variables for the log file, we need to script a change to both the "Aclient.inp" and the "HKEY_LOCAL_MACHINE" registry of the automation agent, so that we can enable unique name logging... I know, tell me about it :(

So using the "Greeneye" article method, we need to modify the "Aclient.inp" in the working folder, with a variable we create from the computers hardware address (MAC Address). We then need to push the log file information into the following registry location:

HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Client Service

Here are the updates since the "Greeneye" article:

  1. With "Aclient", the "LogFile" registry key was a DWORD and was set to "1" in order to enable logging. With "DAgent", this registry key has now changed name to "UseLogFile". That, straight away, will cause problems for logging.
     
  2. With "Aclient", the actual log file name was stored in the registry string "LogFileName", whereas "DAgent" now repurposes the "LogFile" value from the first point. These two items combined are why logging fails under WinPE v2.1.

... and that's it really.


Description
The batch file we will use in this example, will take the MAC Address from an "ipconfig" command (within automation, on each client) and use this as a unique suffix for a log file. To make this all work, the batch file will 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". Go to the "Edit" option and locate the "Configuration" screen. Note: If this is a new configuration you will need to go through and setup the initial configuration steps to get here. Once you are at the configuration screen, you will see a default set of folders and files including a "Startup" folder, "Startup.bat" script, etc.
 
One VERY important step here is to ensure that NONE of the logging information is configured within the "Aclient.inp" file. If you have previously configured logging information, you will need to edit this file and place a semi-colon (";") in front of the configuration line to comment it out. If any logging information is set within the "Aclient.inp" file, nothing we do in the next step will work.
 

Step 2: Add the batch file
Right click the "Startup" folder in the "Configuration" dialog, and select "New" > "Text File". Name the new text file with the ".bat" extension, for example "LogFileChange.bat". Copy in the following contents:
 
@ECHO OFF
CLS

REM ##############################################################
REM  Create unique log files for all connected clients...
REM ##############################################################


REM ::: Notification message...
ECHO Creating WinPE Agent Log
ECHO ------------------------------


REM ::: Get the MAC Address and pass to the procedure...

set temp_i=default
for /f "tokens=1,2 delims=:" %%i in ('ipconfig /all') do call:setname "%%i" "%%j"
ECHO * Computer hardware address is: %MAC_ADDR%


REM ::: Return from the procedure and set the log file name...
set LogNameReg=F:\\LOG\\Aclient-%MAC_ADDR%.log
Set LogNameInp=F:\LOG\Aclient-%MAC_ADDR%.log
ECHO * Setting log file path/name: %LogNameInp%


REM ::: Register the log settings with the DAgent...
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 "UseLogFile"=dword:00000001 >> %_work%\temp.reg
echo "LogFile"="%LogNameReg%" >> %_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:00005000 >> %_work%\temp.reg


ECHO * Creating agent configuration registry
set _Agent_cfgpath=%_work%\
echo LogFile=%LogNameInp% >> %_work%\aclient.inp
echo LogSize=20480 >> %_work%\aclient.inp
echo LogErrors=Yes >> %_work%\aclient.inp
echo LogInformation=Yes >> %_work%\aclient.inp
echo LogDebug=Yes >> %_work%\aclient.inp


ECHO * Configuring agent log settings
regedit /s %_work%\temp.reg
ECHO * Configuration complete, starting Agent with logging...
ECHO.
ping -n 5 127.0.0.1 >NUL
goto:eof


REM ::: Procedure to set the log file name...
: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%"=="Ph" set MAC_ADDR=%temp_j%
goto:eof
NOTE: In the script above, I am using a "LOG" folder created within the "Express" share. As the default mapping for the "Express" share is the "F:" drive, my log paths are "F:\LOG\<filename>". Please change this to suit your environment. It's also worth noting that I decided to use two variables for the log path. the "LogNameReg" variables uses double-slashes for the paths, as is required to build registry files. The "LogFileInp" is a copy of the path using a single back-slash for the filesystem. This is not really necessary, but is something I felt that wanted to do.
 
Step 4: Build WinPE
Click "Next" and continue to build WinPE as normal. When the client computers boot up, they will log to the directory specified in the batch file above.
 
With that, you should start seeing log files appear in the chosen directory, the moment that the DAgent successfully loads within the WinPE v2.1 automation.
 
I hope this helps.

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.