MEMCM: Set Component Log File Size

One common task that you might have to do in your environment is configure the log file size for the various MEMCM components (such as distmgr.log, wsyncmgr.log, etc.). These would be all of the logs on your primary site server that are in the <MEMCM install dir>\logs directory, or any server in which the “Component server” role is installed (so management points, software update points, etc).

The default size for the majority of MEMCM components is 2MB, which in most environments is not enough.

This post discusses two of the ways to set this size. It primarily focuses on a PowerShell script that will set all of these automatically, and accounts for new components added in future releases.

Manually Update Log Size

The log size of the individual MEMCM components can be manually adjusted from the Configuration Manager Service Manager.

  1. Launch the MEMCM console and go to the Monitoring workspace.
  2. Expand System Status and click Site Status.
  3. From the ribbon, click Start, then Configuration Manager Service Manager.
  4. Find the component to change the log file size (ex. SMS_DISTRIBUTION_MANAGER).
  5. Right-click the component and select Logging.
  1. Enter the new log size and click OK.

That’s it. The log size is immediately set and distmgr.log will now be 10MB.

Script Method

That might be a little time-consuming to do for every component. This value is also stored in the registry and can be changed via a PowerShell script. Here is a script that will set the size to 10MB on all components running on the server.

$log_size = "10485760"

# get all components
$reg_keys = (get-childitem -path HKLM:\SOFTWARE\Microsoft\SMS\Tracing).name | Foreach-Object {$_ -replace "HKEY_LOCAL_MACHINE", "HKLM:"}

# loop through each component, setting the max log file size
ForEach ($reg_key in $reg_keys) {

$component = $reg_key.replace("HKLM:\SOFTWARE\Microsoft\SMS\Tracing\","")
$cur_log_size = (get-itemproperty -path $reg_key).MaxFileSize

# set log file max size if current size is less than desired size
if ($cur_log_size -lt $log_size) { 
Set-ItemProperty -path $reg_key -name MaxFileSize -value $log_size
write-host "$component changed to $log_size" -foregroundcolor green
}

# report to screen that log file is already set to desired size
if ($cur_log_size -eq $log_size) { 
write-host "$component already set to $log_size" -foregroundcolor cyan
}

# report to screen that log file is set to a higher desired size
if ($cur_log_size -gt $log_size) { 
write-host "$component set to higher value of $cur_log_size" -foregroundcolor magenta
}

# clear used variables for next loop
$component = ""
$cur_log_size = ""
}

All you need to do to run this script is set the $log_size variable to your desired size. I would suggest setting one log file manually, looking at the corresponding registry key, and then coping the decimal value over. That way, you know for sure that you have the right value.

  1. Go through the steps for manually setting the log file size.
  2. Open Registry Editor and navigate to the component you set. For SMS_DISTRIBUTION_MANAGER, that is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Tracing\SMS_DISTRIBUTION_MANAGER.
  3. The value is available in the MaxFileSize key value (the value in parentheses).

This script will set the log file size, unless the log file size is already equal to or greater than the size you specify, and output what it set to the screen.

Disclaimer

All content provided on this blog is for information purposes only. Windows Management Experts, Inc makes no representation as to accuracy or completeness of any information on this site. Windows Management Experts, Inc will not be liable for any errors or omission in this information nor for the availability of this information. It is highly recommended that you consult one of our technical consultants, should you need any further assistance.

Share:

Facebook
Twitter
LinkedIn
Picture of Matt Tinney

Matt Tinney

Professional IT executive & business leader having decades of experience with Microsoft technologies delivering modern-day cloud & security solutions.

Contact Us

=
On Key

More Posts

WME Cybersecurity Briefings No. 024
Cyber Security

WME Security Briefing 28 August 2024

GhostWrite Vulnerability in T-Head CPUs Exposes Devices to Unrestricted Access Overview A critical architectural flaw in T-Head’s XuanTie C910 and C920 RISC-V CPUs was uncovered by recent research from the CISPA Helmholtz Center for Information Security. Dubbed GhostWrite, the vulnerability

Click Here to Read Full Article »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.

=