Make CMTrace as default log viewer during the Imaging process(OSD)

While analyzing the SCCM logs every engineer wants to open log files by default in CMTrace. But When you log in to a new build machine and open the CCM logs or any *.log files from the machine, the log files will open in the notepad by default. Reading the SCCM log files into notepad is very difficult, Microsoft is providing the live log reading tool call CMTrace with the SCCM suite. In this post, we are going to make it the default app for log files. We will create the SCCM package and deploy it via Task Sequence execution while Operating System Deployment step.

To achieve this, create a new package using the below PS1 code and deploy it on required DPs


SCCM Package Distribution















Edit TS, Add -General -Run PowerShell Script step anywhere post-WinPE and rename Step as "CMTraceDefault2.1" provide above package, script name should be the PS1 file name. Set PowerShell execution policy as "bypass".

All done!, now deploy this Task Sequence on the targeted machine and comment me if CCM log files are opening into the CMTrace by default👍😊

CMTrace default log viewer















<#

 

    .SYNOPSIS

 

        Make CMTrace as default log viewer during the Imaging process(OSD)

 

    .DESCRIPTION

 

        Reading the SCCM log files into notepad is very difficult, Microsoft is providing the live log reading tool call CMTrace with the SCCM suite. This script will make it the default app for log file extensions.

 

    .NOTES

 

    =============================================================================================================================================

 

        Created with:     Windows PowerShell ISE

 

        Created on:       Tuesday, September 14, 2021, 11:44:03 AM

 

        Created by:       Dashrath Chate

 

        Organization:     Blogger.com

 

    =============================================================================================================================================

 

#>

 

New-Item -Path 'HKLM:\Software\Classes\.lo_' -type Directory -Force -ErrorAction SilentlyContinue

 

New-Item -Path 'HKLM:\Software\Classes\.log' -type Directory -Force -ErrorAction SilentlyContinue

 

New-Item -Path 'HKLM:\Software\Classes\.log.File' -type Directory -Force -ErrorAction SilentlyContinue

 

New-Item -Path 'HKLM:\Software\Classes\.Log.File\shell' -type Directory -Force -ErrorAction SilentlyContinue

 

New-Item -Path 'HKLM:\Software\Classes\Log.File\shell\Open' -type Directory -Force -ErrorAction SilentlyContinue

 

New-Item -Path 'HKLM:\Software\Classes\Log.File\shell\Open\Command' -type Directory -Force -ErrorAction SilentlyContinue

 

New-Item -Path 'HKLM:\Software\Microsoft\Trace32' -type Directory -Force -ErrorAction SilentlyContinue

 

New-ItemProperty -LiteralPath 'HKLM:\Software\Classes\.lo_' -Name '(default)' -Value "Log.File" -PropertyType String -Force -ea SilentlyContinue;

 

New-ItemProperty -LiteralPath 'HKLM:\Software\Classes\.log' -Name '(default)' -Value "Log.File" -PropertyType String -Force -ea SilentlyContinue;

 

New-ItemProperty -LiteralPath 'HKLM:\Software\Classes\Log.File\shell\open\command' -Name '(default)' -Value "`"C:\Windows\CCM\CMTrace.exe`" `"%1`"" -PropertyType String -Force -ea SilentlyContinue;

 

New-Item -Path "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\CMtrace" -type Directory

 

new-itemproperty "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\CMtrace" -Name "Version" -Value 1 -PropertyType String -Force

 

new-itemproperty "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\CMtrace" -Name "StubPath" -Value "reg.exe add HKCU\Software\Microsoft\Trace32 /v ""Register File Types"" /d 0 /f" -PropertyType ExpandString -Force

No comments:

Post a Comment

Leave your valuable words here for improve better.