OSD icon indicating copy to clipboard operation
OSD copied to clipboard

Auto include CMTrace?

Open ronmanp opened this issue 2 years ago • 4 comments

Hi just sharing an idea. The same way DaRT alonside its MDT config file are automatically included in WinPE I suggest CMTrace gets also included when found in C:\Windows\CCM\CMTrace.exe . Both OSDCloud and OSDBuilder would greatly benefit from CMTrace being included as it is the perfect tool for reading log files.

Can definitely be done manually by ourselves just by copying the executable into System32 so it's not that important for OSD to support it but it would be a nice to have.

Thank you!

ronmanp avatar Apr 26 '22 17:04 ronmanp

Do you mean you want CMTrace downloaded and added to WinPE if not there, or during the OSDCloud process, when it's Applying the OS, it would download a copy of CMTrace and add into the newly installed OS, some place like "C:\Program Files\CMTrace\CMTrace.exe"?

Being that you're booting into WinPE from boot media, and formatting the drive with OSDCloud, it will never find CMTrace in C:\Windows\CCM.

Typically I include CMTrace in my own boot media now. Could you please expand on your request.

gwblok avatar May 26 '22 19:05 gwblok

Sorry what I meant was automatically including CMTrace in the OSDCloud WinPE. If c:\windows\ccm\cmtrace.exe exists then it would copy it in the System32 folder of the WinPE media I'm creating.

It would work in a similar way as what OSDCloud already does when it imports DaRT and the MDT configs. If it finds it then it includes it automatically in the WinPE media.

ronmanp avatar May 26 '22 20:05 ronmanp

I think it would fit right there https://github.com/OSDeploy/OSD/blob/1f641bfe744f91204fc29879c12620ab8b581e3a/Public/OSDCloud.Setup.ps1#L1138

Something like that would be enough?

    #=================================================
    #   Adding Microsoft CMTrace
    #=================================================
    Write-Host -ForegroundColor DarkGray "========================================================================="
    Write-Host -ForegroundColor Cyan "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) Microsoft CMTrace"
    $SourceFile = "$env:windir\CCM\CMTrace.exe"
    if (Test-Path $SourceFile) {
        Write-Host -ForegroundColor DarkGray $SourceFile
        Copy-Item -Path $SourceFile -Destination "$MountPath\Windows\System32\CMTrace.exe" -Force
    }
    else {
        Write-Warning "Could not find $SourceFile"
    }

ronmanp avatar May 26 '22 21:05 ronmanp

Can you add support for this statement? "Both OSDCloud and OSDBuilder would greatly benefit from CMTrace being included as it is the perfect tool for reading log files"

OSDBuilder I get because it has DISM logs, but it's not in a WinPE environment, and OSDCloud uses a PowerShell Transcript is used as this provides a clear log of the Console Output.

It is a nice to have, but unless there is a good use case for it, I'll keep this open as an Enhancement until there is more Community Feedback

OSDeploy avatar May 27 '22 03:05 OSDeploy

Closing issue. I've also looked into it, as a personal preference, but I have not found a way to download CMTrace from Microsoft. At this point, if people want CMTrace in WinPE and in their OS after, they will have to do something custom like I do. Mounting WinPE and copying it in, and running a post script that copies it from WinPE into the Full OS.

Until MS has a simple download for CMTrace, like it does for other things like sysinterals, it won't be included in OSDCloud

gwblok avatar Mar 18 '24 14:03 gwblok