This post is pending since long and finally has come out. CMtrace.exe (Configmgr guys favorite tool) is log file viewer which is friendly ,lot more easier to files with .log extension .To know more about about cmtrace log and its benefits, read Garth post here .
This tool can be downloaded from Configuration manager 2012 R2 tool kit http://www.microsoft.com/en-us/download/details.aspx?id=36213. Download and install the toolkit .After the install ,You will find CMTrace in C:\program files (x86)\Configmgr 2012 toolkit R2\clientTools.
Garth posted blog on How to install CMTrace using application model here .In this post,Garth explained ,how to copy the CMtrace tool to C:\windows\system32 and from there you can double click this tool to read .log files .
In my post,I will show you,how to make this tool as default log viewer for all users without the need of going to system32 and double click cmtrace.exe .
This process consists of 2 applications (both share common source) ,each with one deployment type. The reason for choosing 2 applications is because one app is for Computer (to copy cmtrace.exe) and other is for User to set default log viewer.
I did not try the method by creating single application with 2 deployment types ,1 copy cmtrace to computers and other for users that does the registry key changes .If you would like to try this method and if it works, drop your solution using the comments section.
Before we start creating applications,download the source files from here. This zip file contains 3 files 1)CMtrace (5.00.7958.1000) 2) Copy_CMTrace.bat 3) Set_CMtrace_Default_Log_Viewer.bat.
We will use the same content (zip file) to create 2 applications to achieve this task.
So first create application 1) Copy CMtrace using Garth blog post but don’t create any deployment ,just only application with deployment type. Distribute to DP’s.
After you are done with Garth post,you will see something like below with application and its deployment type.
Now lets create Application 2) CMTrace Default Log Viewer .Creation of the application with script as deployment is similar to other applications you normally create but one thing you need to look at is ,detection method which is given below.
Right Click and choose create application
Select manually specific application information
Enter the application Name
You can configure this section as you need else click next
Click Add Deployment Type
select manually specific the deployment type information
Enter the Deployment Type Name
Select the content location and installation program as shown below .
Click on Add clause
Use the following for detection rule:
Setting Type:Registry
Hive:HKEY_CURRENT_USER
Key:Software\Classes\Log.File\shell\open\command
DataType: string
Value:C:\Windows\system32\cmtrace.exe "%1"
Click OK
Click Next
User Experience tab ,select Installation behavior : Install for User ,Visibility:Hidden and maximum run time:15 min
Requirement Tab ,click next unless you have any requirements to check before it install
For Dependencies tab ,we will now add the Copy CMTrace that we created using Garth blog post
Click add Add under dependencies tab
Enter name and click on Add ,select the copy CMtrace script
Click Next
Review Summary Page
Click Next ,next ,next
Distribute the application to distribution points ,monitor the status.
with this ,we have now created 2 applications with its deployment types and we are now ready to deploy to users.
We will now deploy the application (Set CMTrace Default log Viewer) to user based collection ONLY.
Right click on Set CMTrace Default log Viewer application and select deploy
select the User based collection
click next for the distribution points
deployment settings ,action: Install and Purpose:Required
select the scheduling time
User experience ,choose what you need
click next ,next next for the completion
Now ,let the user who is member of the deployed collection login to any client ,he/she will be able to open the .logs using cmtrace as default log viewer.
Results:
On User PC, initiate user policy retrieval from configuration manager applet,control panel ,wait for couple of min for client to download and execute the policy. Go to C:\windows\ccm\logs ,open any of the log, you will see the log file open automatically using cmtrace.
Thanks to Jay(happysccm) for providing the fix to suppress the above window (HKCU\Software\Microsoft\Trace32] "Register File Types"="0" )
scripts are updated with above registry setting.
Summary:
We created 2 applications 1) for computer and 2) for user ---first app as dependency to this application and deploy to user collection.
Hope you enjoyed this article and helpful too!
11 Comments
Hello! Is this still working, the bat file is running, and the reg changes have occured and cmtrace is in place, but the file associations in Windows isn't changing for log files.
Hi,
It has been quite sometime since i have tested this. Let me test and update you.
thanks,
Eswar
Thanks a lot ! Works like a charm.
I know you posted this over a year ago but.... I just cannot get it to detect on the HKCU key. I've combined both your instructions and Garth's instructions in to one app using the Powershell App Deploy Toolkit so that I could write the HKCU keys to each user (plus default). It installs fine, the keys are written to the correct location but on my detection it refuses to even detect on the existence of the Software\Classes\Log.File\shell\open\command key. If I remove the detection on the key and only use a detection on the existence of cmtrace it detects fine. Any ideas?
Haven' tried this method. Can you post me the script you are trying, so I can try in my lab to see what is not working?
I get unmatched exit code (4) when it runs Copy_CMTrace.bat
Do I need to set permissions?
Is that same error code on all clients or only specific ? are you running the script manually or using Configmgr ?
If it is running from Configmgr, it uses system account to install hence no permissions issue.
Thanks,
Eswar
Hi Eswar,
Same error code on all clients, it is running from SCCM
Hi TC,
when you say about same error code, is that when user open log, it is not opening with cmtrace ? did you check if the registry keys loaded correctly or not ?
Thanks,
Eswar
Thank you very much, very useful article!
Welcome Alexandr.