Reply To: Delete' Windows.old' folder using powershell

  • Roddy Gelberty

    Member
    21 July 2020 at 9:02 pm

    A few amendments to Topaz’s answer. use ‘start-process‘ cmdlet to start ‘cleanmgr.exe‘.

    If(Test-Path -Path($((Get-WmiObject Win32_OperatingSystem).SystemDrive) +"\windows.old")){ 	New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations" -Name "StateFlags1221" -PropertyType DWORD  -Value 2 -Force | Out-Null 	Start-Process -FilePath "cleanmgr" -ArgumentList /SAGERUN:1221 -Wait -WindowStyle Hidden}

DCOM hardening issue.

This application fails to authenticate with WMI on the SCCM server because Microsoft has not yet hardened DCOM on their Windows Preinstallation Environment. We are working on a different approach, but it will only be released during the first quarter of 2024. But until that time, the only workaround will be to uninstall the update corresponding to KB5004442.