As the first post in the Configuration Manager OSD Support Team Blog, I am going to go over something that affects us a lot in CSS - increasing the size of the SMSTS.log and specifying how many times it rolls over. Many times when troubleshooting customer issues with a Task Sequence, we discover that the logs have rolled over and that we have lost the logging and history of what happened when the issue actually occurred. Without these logs and history it makes it very difficult to determine what the problem is.
Luckily both the SMSTS.log size and the amount of time it rolls over can be changed. The tricky part though is that in order for the changes to apply during the entire Task Sequence, you may need to make these changes up to three times during the Task Sequence.
Here are two quick tips regarding the below article:
When deploying a Task Sequence, there may be times that the options of the SMSTS.log file need to be changed, such as increasing the size of the log or the amount of historical logs (rolled over logs) that are created. If the SMSTS.log size is not increased or the amount of historical logs is not increased, information about what happened during the Task Sequence may be lost. In troubleshooting scenarios this may make it difficult to determine what is causing problems.
The Task Sequence has the potential of running in three different Windows OSes before it completes:
Because of this, if options for the SMSTS.log file need to be changed, they may need to be changed each time the Windows OS changes. This can be up to three different times during a Task Sequence.
In order to change the options for the SMSTS.log, they need to be changed in three different locations:
Additionally, in order for the logging options to work properly throughout the deployment, the settings for the logging options should match and be the same during each stage of the deployment.
Original Windows OS: Modify the registry in the original Windows OS (Replace and Refresh scenarios only)
When the ConfigMgr client is originally installed on a PC, the ConfigMgr client logging options can be set via MSI properties in the command line of the client install. These options include the following parameters:
The above parameters are described in the following TechNet article:
About Configuration Manager Client Installation Propertieshttp://technet.microsoft.com/en-us/library/bb680980.aspx
To change any of the above parameters after the ConfigMgr client has been installed, instead of reinstalling the client with the necessary parameters, the corresponding registry entries can be changed instead:
ConfigMgr 2007 32bit OSes and all ConfigMgr 2012HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CCM\Logging\DebugLogging!Enabled ConfigMgr 2007 64bit OSesHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\CCM\Logging\DebugLogging!Enabled
A STRING value of TRUE enables debug logging. Deleting the DebugLogging key disables debug logging.
ConfigMgr 2007 32bit OSes and all ConfigMgr 2012HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CCM\Logging\@GLOBAL\debuglogging!LogEnabled ConfigMgr 2007 64bit OSesHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432NodeMicrosoft\CCM\Logging\debuglogging!LogEnabled
A DWORD value of 1 enables logging, while a DWORD value of 0 disables logging. The default is 1 (enabled).
ConfigMgr 2007 32bit OSes and all ConfigMgr 2012HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CCM\Logging\@GLOBAL!LogLevelConfigMgr 2007 64bit OSesHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432NodeMicrosoft\CCM\Logging\@GLOBAL!LogLevel
The value can be a DWORD value from 0 to 3, with 0 being the most verbose logging. The default value is 1.
ConfigMgr 2007 32bit OSes and all ConfigMgr 2012HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CCM\Logging\@GLOBAL!LogMaxHistory ConfigMgr 2007 64bit OSes HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432NodeMicrosoft\CCM\Logging\@GLOBAL!LogMaxHistory
The value is a DWORD value that specifies the amount of rolled over/historical logs to keep. This does not include the current log. A value of 3 would keep a total of 4 logs - the current log and 3 rolled over/historical logs. The default value is 1.
ConfigMgr 2007 32bit OSes and all ConfigMgr 2012HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CCM\Logging\@GLOBAL!LogMaxSizeConfigMgr 2007 64bit OSesHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432NodeMicrosoft\CCM\Logging\@GLOBAL!LogMaxSize
The value is a DWORD value for the size of the log file in bytes (decimal). The default value is 250000 (decimal) which equals 250000 bytes (approximately 245 KB).
Generally, for the purposes of the SMSTS.log and OSD, the only three parameters that need to be changed are CCMLOGLEVEL, CCMLOGMAXHISTORY, and CCMLOGMAXSIZE. Logging is set by default, so CCMENABLELOGGING normally does not need to be changed.
Please note that changing any of the above values changes the settings for ALL ConfigMgr client logs, not just the SMSTS.log.
After the value of any of the above values has been changed in the registry, the ConfigMgr client needs to be restarted in order for the changes to take effect. This can be done by restarting the ConfigMgr client service (SMS Agent Host) or restarting the computer.
Since a restart of the ConfigMgr client needs to take place, any of changes to the values of the above registry keys cannot take place during a Task Sequence. Any attempt to restart the ConfigMgr client service in the full Windows OS while the Task Sequence is running will kill the Task Sequence and cause it to fail (since the Task Sequence engine is dependent on the ConfigMgr client service). For this reason, any changes to the above registry key values, and the subsequent restart of the ConfigMgr client service, need to be done outside of a Task Sequence and before the Task Sequence begins (i.e. manually, normal ConfigMgr Software Distribution, Domain Policy, etc.)
Please note that in Replace scenarios, the above changes would need to be done on the original/old computer.
If when attempting to modify any of the above registry keys you receive the following error message:
Error Editing ValueCannot edit <value>: Error writing the value's new contents
where <value> is the key value trying to be changed, this is usually due to insufficient permissions on the @GLOBAL registry key for the user trying to make the change. To resolve the issue, modify the permissions of the @GLOBAL key to allow the user making the changes to modify the values under the key.
Windows PE Boot Image: Add the SMSTS.ini file to the Windows Directory of the Boot Images (New Computer, Refresh, and Replace scenarios)
During an OSD Task Sequence, when the PC boots into WinPE from the Boot Image, the SMSTS.log settings are not controlled via the same registry keys as in the full Windows OS. Instead the SMSTS.log settings are controlled via entries in a file called SMSTS.ini file which resides in the Windows directory of WinPE.
In order to change the logging options for the SMSTS.log file while in WinPE, the SMSTS.ini files has to be either created or modified with the appropriate parameters. If no SMSTS.ini file exists in the Windows directory of WinPE, then default values are used. By default, the SMSTS.ini file does not exist in the default Boot Images of ConfigMgr and therefore the default options are used.
The logging options and values that can be modified are:
The value names are basically the same as the registry value names from the full OS, but without the preceding CCM prefix. Similar to logging in the full OS, for the purposes of the SMSTS.log and OSD, the only three parameters that usually are changed are LOGLEVEL, LOGMAXHISTORY, LOGMAXSIZE. The value of LOGMAXSIZE is specified in bytes.
To modify the values, in NotePad, create a SMSTS.ini file with a [Logging] section that contains the parameters that need to be modified. The file then needs to be injected in the Windows directory of the Boot Image. The SMSTS.ini file has to be in place BEFORE the Task Sequence begins in WinPE. For this reason, the SMSTS.ini file cannot be added or copied to the appropriate location as part of the Task Sequence.
For example, to change the SMSTS.log file size to 5MB, set the log level to the most verbose level, and increase the amount of rolled over/historical logs to 3, the following would be the contents of the SMSTS.ini file:
Note: The logging options in the SMSTS.ini file are case sensitive and should be entered in all uppercase.
Injecting the SMSTS.ini file into the Boot Image
ConfigMgr stores files to be injected into the Boot Images under the following two directories on the site server:
x86 Boot Images<ConfigMgr_Install_Directory>\OSD\bin\i386x64 Boot Image<ConfigMgr_Install_Directory>\OSD\bin\x64
The files located in the above two directories are not necessarily automatically injected into the Boot images. An XML file is used which defines which files need to be injected, where the files are located within the BIN directory, and where they need to be copied to within the WinPE Boot Image. The name of this XML file is osdinjection.xml. It is located in the following directory on the site server:
Please note that the above directory is NOT the same as where the files to be injected reside. Additionally only one osdinjection.xml file is needed for both x86 and x64 Boot Images.
To inject the SMSTS.ini file into the Boot Images:
Once the Distribution Points have finished updating for each Boot Image, each Boot Image should have the updated log settings for the SMSTS.log.
As an option, instead of using the above process, after the SMSTS.ini has been created, it can be manually injected into the Windows directory of the Boot Image using ImageX or DISM. However using the above process preserves and does not modify the original Boot Image (boot.wim), so it is the preferred method.
Newly installed Windows OS: Add logging options to the Setup Windows and ConfigMgr task of the Task Sequence (New Computer, Refresh, and Replace scenarios)
Since the ConfigMgr client is always installed as part of a ConfigMgr OSD Task Sequence, the MSI properties to set logging options, as explained under the section "Modify the registry in the original Windows OS", can be used to change the logging options of the SMSTS.log:
For example, to change the SMSTS.log file size to 5MB, set the log level to the most verbose level, and increase the amount of rolled over/historical logs to 3, the following would be added to the "Installation properties" text box of the "Setup Windows and ConfigMgr" task:
CCMLOGMAXSIZE=5242880 CCMLOGLEVEL=0 CCMLOGMAXHISTORY=3
Please note that any changes made to the logging options in the "Installation properties" text box of the "Setup Windows and ConfigMgr" task will affect ALL ConfigMgr client logs and not just the SMSTS.log.
Note: Make sure that an SMSTS.ini file does not exist in the newly installed Windows OS. Adding or copying a SMSTS.ini file to the Windows directory of the newly installed Windows OS will not work and may conflict with the MSI properties specified at the "Setup Windows and ConfigMgr" task.
Frank RojasSupport Escalation Engineer
The text say "Since a restart of the ConfigMgr client needs to take place, any of changes to the values of the above registry keys cannot take place during a Task Sequence."
Surely we can do the change in the TS (running as system with full permission so writing to this values is not a problem) and then have a Restart Computer step back to the currently installed default OS?
Wouldn't that work?
You are probably correct that that will work. I actually thought of putting exactly this information in the article, but there is one problem with this approach. Anytime you use the Restart Computer task with the option "The currently installed default operating system" in the full Windows OS BEFORE the "Setup Windows and ConfigMgr" task, the computer does not auto log back in. This in itself does not cause any technical problems because even if a user doesn't log in, the Task Sequence does continue in the background once the computer finishes rebooting and the SMS Agent Host service starts back up. However sometimes the Task Sequence visual progress is no longer displayed, even if a user logs in. This is not ideal, and may even be confusing to an end user.
Additionally, there may be situations where the logging options need to be set before we have even had a chance to set the logging options via the Task Sequence. It's kind of like a chicken and egg problem.
One of the things I considered adding was using the "Run another program first:" option under the Advanced tab in the Properties of the Task Sequence to set the appropriate registry keys. However it still would have a required a restart of the SMS Agent Host service, and I am unsure how that would affect the Task Sequence. Would a program run using "Run another program first:" option that restarted the SMS Agent Host service or restarted the computer cause the Task Sequence not to start after the program finished restarting the SMS Agent Host or computer? I am not sure, and it is the reason why I recommended using a method outside of the Task Sequence to set the registry settings.
With that said, in Refresh/Replace scenarios, for the original/old OS, I see no problem with setting the logging options via registry settings in the Task Sequence itself as long as the limitations of doing so are known and understood (computer does not auto log back in/Task Sequence progress may not display again until the computer reboots into the WinPE portion of the Task Sequence).
Frank, I would vote this the Blog of the YEAR!!! This is amazing stuff. Thanks!