Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

SOLVED Deploy cmtrace tool using sccm

Status
Not open for further replies.

Ashish

Member
Messages
12
Reaction score
1
Points
3
Dear all,

I am seeking suggestion/guidance from someone who the experience of deploying "CMTrace" tool to all PCs in their environment. What is the best way to do that? I only want to drop it to a C:\ Windows so that the local IT support can go to this location and use the CMTrace to open log file.

Thanks in advance.

Regards
Ashish
 
Create a powershell script file (for example install.ps1) and paste the below script. Ensure CMTrace is in the same directory as the PowerShell script.

Command usage - powershell.exe -executionpolicy bypass -file install.ps1

Code:
 $RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\"   
$Architecture = Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture 
$Architecture = $Global:Architecture.OSArchitecture 
If ($Architecture -eq "32-bit") { 
      Copy-Item -Path $RelativePath"CMTrace.exe" -Destination $env:ProgramFiles"\Windows NT\Accessories" -Force 
      $Parameters = "Ftype logfile="+[char]34+$env:ProgramFiles+"\Windows NT\Accessories\CMTrace.exe"+[char]34+" %1" 
      cmd.exe /c $Parameters 
} else { 
      Copy-Item -Path $RelativePath"CMTrace.exe" -Destination ${env:ProgramFiles(x86)}"\Windows NT\Accessories" -Force 
      $Parameters = "FType logfile="+[char]34+${env:ProgramFiles(x86)}+"\Windows NT\Accessories\CMTrace.exe"+[char]34+" %1" 
      cmd.exe /c $Parameters 
} 
$Parameters = "assoc .log=logfile" 
cmd.exe /c $Parameters
 
Status
Not open for further replies.
Back
Top