usr/Clear-AppCompatCache.ps1
function Clear-AppCompatCache { <# .SYNOPSIS Flushes the application compatibility cache. .DESCRIPTION The data of cache is stored in the registry by path 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager'. .INPUTS None .OUTPUTS System.Boolean if successed otherwise null (shows warn). .NOTES The caller must be an administrator. #> [CmdletBinding()]param() end { (Test-IsAdmin) ? $( New-Delegate kernelbase { bool BaseFlushAppcompatCache } $kernel32.BaseFlushAppcompatCache.Invoke() ) : (Write-Warning 'pwsh should be elevated') } } Export-ModuleMember -Function Clear-AppCompatCache |