Use this script in a TS to set the Default Log File Viewer for *.LOG and *.LO_ files in Windows.
I originally got this script from Jorgen at CCMexec.com who has some great content, but I just shortened it a bit for my own use to use in my Windows Server 2016/2019 Build TS running as a “Run PowerShell Script” step.
################################################################## # # Script Name: Set_CMTrace.ps1 # # Description: Sets CMTrace Tool as Default Log Viewer # # Version History: 1.0 - Initial Script # ################################################################## # Create .Log and .Lo_ Keys to make CMTrace.exe the Default Log Viewer New-Item -Path HKLM:\SOFTWARE\Classes.lo_ -Value "Log.File" -Force -ErrorAction SilentlyContinue New-Item -Path HKLM:\SOFTWARE\Classes.log -Value "Log.File" -Force -ErrorAction SilentlyContinue New-Item -Path HKLM:\SOFTWARE\Classes\Log.File\shell\open\command -Value "`"C:\Windows\CCM\CMTrace.exe`" `"%1`"" -Force -ErrorAction SilentlyContinue #Create ActiveSetup to remove CMTrace question if it should be the Default Log Reader New-Item -Path "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\CMtrace" -Force -ErrorAction SilentlyContinue New-ItemProperty "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\CMtrace" -Name "Version" -Value 1 -PropertyType String -Force -ErrorAction SilentlyContinue 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 -ErrorAction SilentlyContinue
I think there is something wrong with line 10
Looks wrong in the ISE and errors with
New-Item : A positional parameter cannot be found that accepts argument ‘C:\Windows\CCM\CMTrace.exe
%1
‘.The formatting seemed to get messed up when I pasted it for the post and added some extra characters in that I didn’t notice. I’ve updated it, thanks for letting me know!