de-DEen-US
Blog_List
The blog about Microsoft products by Matthias Schlomann
 Matthias Schlomann
 18  3641  12/9/2015
Categories
Blog

Delete old Windows Install after Upgrade with Power Shell

By Matthias Schlomann on 12/9/2015

After running an Upgrade from Windows 7 / 8.x to Windows 10 without issues, you have to delete the Old System files.  You can simplify do this with this Power Shell command.

 

$path = Join-Path $env:SystemDrive -ChildPath "windows.old"
If(Test-Path -Path $path)
{
    $regpath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations"
    New-ItemProperty -Path $regpath -Name "StateFlags1221" -PropertyType DWORD  -Value 2 -Force  | Out-Null
    cleanmgr /SAGERUN:1221
}

Administration
Infrastructure
Windows
Power Shell
PowerShell
Upgrade
Windows 10
Windows 7
Windows 8
Windows Client
Blog_Archive
Blog_Tags
Privacy Statement | Terms Of Use | © 1994-2024 by AARSYS - Matthias Schlomann