Created
September 6, 2022 09:18
-
-
Save xtu/8b12461bfa0df041cbb7cd31299d45e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$env:FUSION_LOG='C:\fusion-log\' | |
function Enable-FusionLog { | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog -Value 1 -Type DWord | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures -Value 1 -Type DWord | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds -Value 1 -Type DWord | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath -Value $env:FUSION_LOG -Type String | |
if (-not (Test-Path $env:FUSION_LOG)) { | |
mkdir $env:FUSION_LOG | Out-Null | |
} | |
$ENV:COREHOST_TRACE=4 | |
Write-Host "Enabled fusion log and save to $env:FUSION_LOG" | |
} | |
function Disable-FusionLog { | |
param( | |
[Boolean] $CleanUp = $false | |
) | |
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog | |
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures | |
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds | |
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath | |
if ($CleanUp -and (Test-Path($env:FUSION_LOG))) { | |
Remove-Item -R $env:FUSION_LOG | |
} | |
if ((Test-Path ENV:\COREHOST_TRACE)) { | |
Remove-Item ENV:\COREHOST_TRACE | |
} | |
Write-Host "Disabled fusion log" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment