Wednesday, November 1, 2023

Associate .log and .lo_ files with CMTrace.exe using group policy

For a long time it has annoyed me that every time I go to a new device I have to find CMTrace open it and answer a couple of questions before I can simply click on a *.log file and begin troubleshooting.  I have been searching for an answer for a while to fix it in my network globally.  It seems that I may have an answer by using Group Policy.  This post will take you step by step to fix the issue in your environment.

On a device with Windows Administrative tools installed hit start and type "group". When you do this you will notice that Windows searches for items containing the word group. Select "Group Policy Management" from the menu.

Navigate to "Group Policy Objects".

Right click "Group Policy Objects" and select "New" from the menu. Enter a name that suits your environment.  I personally like to use names that are descriptive of what the policy is intended to do. So mine will be "Set log files to use CMTrace.exe"
Click "OK" to create the policy, then right click on this policy and select "Edit..."
In the "Group Policy Management Editor", navigate to "Computer Configuration\Preferences\Control Panel Settings\Folder Options"
Right click on "Folder Options" and select "New\File Type" from the menu
In the "New File Type Properties" window make the following changes
  • Action:  "Update"
  • File extension: "log"
  • Associated class: "CCM Debug Log"
  • Tick "Configure class settings"
  • Icon file path: "C:\Windows\CCM\CMTrace.exe"
  • Icon index: "0"
  • Actions:
  • Click "New..." and in the "New Action" window add the following
    • Action: "Open"
    • Application used to perform action: "C:\Windows\CCM\CMTrace.exe"
    • Click "OK" to register the action
  • Tick "Always show extension"
  • New File Type Properties should look like the below image.

  • Click "OK"
  • Repeat the "New File Type" process with the only change being File Extension will be "lo_". Note: "lo_" is the extension used when a log file overflows and a new log is started.
In the "Group Policy Management Editor" right click your policy name (Top line in the left hand pane) and select Properties. In the properties window, tick "Disable User Configuration settings".  This is done as best practise.  there will be no user settings so less processing if it is disabled. Click "Yes", when prompted and the Click "OK" to save the changes.
Close "Group Policy Management Editor".  All you need to do now is apply the policy where you would like it to apply.  I want it to apply to all of my computers so it will be linked at the domain level.  You may have other requirements

Now when you look at log files you will notice that they now have a type of "Microsoft.CCM.DebugLog" rather than the default "Text Document".  Clicking on one of these and you will be asked to select an app to open this .log file.  you will note the under "Suggested apps" "CMTrace_x86.exe" is available (no need to hunt for it).  Simply select "CMTrace.exe" and then click "Always" (to make the choice as your default). 
Click "Yes" at the prompt "Do you want to make this program the default viewer for log files" and you are done.

No more hunting for CMTrace...  It just works from then on.

No comments:

Post a Comment

Search for large files in Windows 10+ : Tip

 Look we have all been there.  You need to find out what is taking up space on your computer.  Previously you needed to use a third part too...