How To: Enable Debug Logging for an OS Deployment Task Sequence

Previously, we covered how to enable debug logging for the ConfigMgr client agent as well as the ConfigMgr 2012 admin console. This post will focus on enabling debug logging for an OSD TS.  This process is a little different when starting OSD from WinPE, as you are starting in a state with no client agent installed.

* There are two steps required to fully enable debug logging for OSD task sequences – 1) WinPE phase (before ‘Setup Windows and Configmgr TS Step), and 2) Windows Phase (during ‘Setup Windows and ConfigMgr TS Step’)

Enabling Debug Logging for WinPE:

Create a file named smsts.ini with the following contents:

[Logging]
LOGLEVEL=0
LOGMAXSIZE=524288000
LOGMAXHISTORY=3
DEBUGLOGGING=1
CCMDEBUGLOGGING=1

Here’s a brief description of each property (review detailed info on TechNet):

LogLevel = 1 is the default value, set this to 0 for the most verbose logging

LogMaxSize = Maximum log file size in bytes – the example is 524288000 bytes (250000 default)

LogMaxHistory = The number of history (aka ‘rollover’) logs to keep (1 is default)

DebugLogging = Set this to 1 (True) to enable debug, which will provide more detail

CCMDebugLogging = Set this to 1 (True) to enable debug, which will provide more detail **I don’t think this is necessary, as we are doing this in the previous step (DebugLogging), but MS has told me multiple times to do it, so I include it.

Next, you need to mount the boot.wim file that will be used for OSD, and copy the file to the \windows directory. Unmount the .wim and commit changes  (Note that the latest version of dism.exe uses the mount-image argument–previous versions used mount-wim).

Now that you have updated the boot.wim, update DPs, and re-create your task sequence boot media. Another note – * Some OSD-savvy admins may attempt to simply open a command prompt at the WinPE welcome screen and drop the smsts.ini file in the x:\windows directory, but this will not work. Smsts.ini must exist in the boot media which is booted to start OS deployment, as it appears to be consumed before the welcome screen appears.

When you launch a TS from WinPE, you will find the following entries in smsts.log (after clicking Next to the welcome screen):

smstslog_debuglogging

Congratulations – you’re half-way there. If you only want to debug during WinPE,  you can stop here. But be advised that as soon as the TS completes the “Setup Windows and ConfigMgr” step, the debug logging (and any additional customizations from the smsts.ini file) will be removed. To preserve the log, continue to the next step:

Enabling Debug Logging for the Windows Phase:

During the “Setup Windows and ConfigMgr” TS step, mini-setup runs, and the ConfigMgr client is installed. The logging used from this point forward will be based on the installation parameters defined during the “Setup Windows and ConfigMgr step. So if you had a larger max log size and history in WinPE, and take the default config for “Setup Windows and ConfigMgr”, that extended logging will be removed (and logs overwritten) as soon as the TS continues from the Windows OS. You could simply modify the arguments for that step to be similar to the following:

CCMDEBUGLOGGING=1 CCMLOGLEVEL=0 CCMLOGMAXSIZE=52488000 CCMLOGMAXHISTORY=5 FSP=MYFSP.mydomain.com SMSCACHESIZE=35840

But please understand this will enable debug logging for the ConfigMgr client agent, which means these settings will apply to all client logging (unless you run something to modify logging at a later point in time). A better scenario would be to only enable the configuration on an as-needed basis. Here’s how I recommend enabling debug logging (and preserving the debug logging provided in WinPE) as needed in a TS.

Create a TS step to set a TS variable:

EnableDebug_setvariable

The variable SMSClientInstallProperties is a builtin TS variable that will override values entered into the “Setup Windows and ConfigMgr” TS step. To take this a step further, create a conditional for this step to only run if x:\debug.txt exists.

EnableDebug_setvariable-2

To leverage this, you can simply open a command prompt while the TS is running (before this step would run) and create a file called debug.txt in the root of x:\.

If you don’t want to add a step to the TS, you could launch a command prompt while the TS is running in WinPE, and run the following VBScript:

Set oTSEnv = CreateObject("Microsoft.SMS.TSEnvironment")
oTSENV("SMSClientInstallProperties") = "CCMDEBUGLOGGING=1 CCMLOGLEVEL=0 CCMLOGMAXSIZE=52488000 CCMLOGMAXHISTORY=5 FSP=MYFSP.mydomain.com SMSCACHESIZE=35840"

This will set the TS variable for a one-time use for this TS.

To recap, I recommend enabling debug logging while in WinPE, and only configure debug logging for the ConfigMgr client as needed. This will give you more debugging while in WinPE, and clean up everything back to your corporate standard after Windows is installed. And then as needed, you can easily add debug logging to the ConfigMgr client agent.

Greg

About Greg Ramsey
Greg Ramsey is a systems engineer specializing in global systems management for Dell IT. He has a B.S. in Computer Sciences and Engineering from the Ohio State University and is a Microsoft Most Valuable Professional (MVP) for Microsoft System Center Configuration Manager. Greg coauthored SMS 2003 Recipes: A Problem-Solution Approach (Apress, 2006), Microsoft System Center Configuration Manager Unleashed (Sams, 2009), Microsoft System Center 2012 Configuration Manager Unleashed (Sams, 2012), and Microsoft System Center 2012 Configuration Manager: Administration Cookbook (Packt Publishing, 2012), and Microsoft System Center 2012 Configuration Manager R2 Unleashed (Sams, 2012). Greg is cofounder of the Ohio SMS Users Group, and the Central Texas Systems Management User Group.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: