/
/

How to Delete the Windows.old Folder Properly in Windows 11

How to Delete the Windows.old Folder Properly in Windows 11 blog banner image

Whenever you update and upgrade or perform a system reset, Windows 11 creates a Windows.old folder to store the previously installed Windows version. This enables rollback within 10 days, but it consumes significant disk space, causing storage bloat (10-30 GB), especially in shared environments. Deleting the folder will ensure optimal system performance, allow installation of new apps, and avoid disruptions in shared environments.

Below is a guide to understanding the purpose of the Windows.old folder, when it can be safely deleted, and how. This guide covers methods using the graphical user interface (GUI), the Command Prompt, and PowerShell, which are suitable for individual and enterprise systems.

Methods for deleting the Windows.old folder

Before deleting Windows.old folder, you need to meet the following requirements:

  • Verify that the upgrade was successful, it is functioning properly, and there is no need to roll back to the previous version.
  • Ensure that the folder is not in use and the system is running from the new or updated Windows installation.
  • Deleting the Windows.old folder requires administrator access; ensure you’re logged into an account with the appropriate permissions
  • Back up important data to an external drive or the cloud to avoid accidental loss.

Method 1: Deleting the Windows.old folder using Storage Settings (GUI)

You can delete the Windows.old folder using the Storage Settings. This is the easiest and safest way to remove the folder, although this is only suitable for one system, not for enterprise environments.

  1. Open Settings > System > Storage.
  2. Click Temporary Files. This will open a list of files Windows considers safe to delete.
  3. Among the options, check Previous Windows Installations.
  4. Confirm the deletion by clicking Remove files. This will permanently remove the folder and free up disk space.

Method 2: Delete the Windows.old folder using disk cleanup (GUI or Command Prompt)

You can delete the Windows.old folder using Disk Cleanup. You can perform this task via the GUI or through the Command Prompt.

Using the GUI

  1. Open the Run dialog via the Win + R shortcut, type cleanmgr, and press Enter.
  2. Select the system drive (C:).
  3. Next, click Clean up system files.
  4. From the list that comes up, select Previous Windows installations. This option will refer to the Windows.old folder.
  5. Click Ok, then Delete Files to confirm. Disk Cleanup will then permanently delete the selected items.

Using the Command Prompt

  1. Open the Command Prompt as an administrator.
  2. Run the following command: cleanmgr /sageset:1. This will open a configuration Window where you can select which files and folders to delete. Select the Previous Windows installation to delete the Windows.old folder, then click Ok.
  3. The dialog box will close; go back to the Command Prompt and type in cleanmgr /sagerun:1. This will execute the cleanup based on the selections you made in step #2.

Method 3: Deleting the Windows.old using PowerShell

Deleting Windows.old using PowerShell is ideal for IT admins managing multiple systems and enterprise environments.

  1. Open PowerShell as an administrator. Press Win + X, then select PowerShell (Admin) or Terminal (Admin).
  2. Next, run this command: Remove-Item "C:\Windows.old" -Recurse -Force.
    1. -Recurse this code deletes all files and subfolders.
    2. -Force overrides file and permission restrictions
  3. After this, the folder will be deleted permanently, and you cannot roll back to a previous version of Windows.

In addition, you also have the option to integrate this command into:

  • Post-upgrade provisioning scripts
  • Scheduled tasks
  • Group Policy logon scripts

This is useful in enterprise and managed environments, helping you clear up space quickly without manual intervention.

Method 4: Use Task Scheduler for automation

In enterprise and virtual desktop infrastructure environments, Task Scheduler is an excellent method to automate its deletion without manual intervention.

  1. Press the Win + S shortcut, search for Task Scheduler, then open it.
  2. Next, create a new task. Click Action > Create Task, then name it. We suggest something relevant, like Delete Windows.old.
  3. Under the General tab, make the following configurations:
    1. Check “Run whether user is logged on or not.
    2. Toggle “Run with the highest privileges.”
    3. Select “SYSTEM from the Change User or Group” option for unhindered access.
  4. Next, set the trigger by heading to the Triggers tab. Click New and choose At logon or At Startup, depending on when you want it to run.
  5. Next, set the action by going to the Actions tab and clicking New. 
    1. Determine the action: Start a program. 
    2. Enter the program/script: powershell.exe
    3. Add arguments: -NoProfile -WindowStyle Hidden -Command "Remove-Item 'C:\Windows.old' -Recurse -Force"
  6. Additional recommended settings
    1. Under the Conditions tab, uncheck “Start the task only if the computer is on AC power” if you use laptops.
    2. Under the Settings tab, check:
      1. Allow task to be run on demand
      2. Run task as soon as possible after a scheduled start is missed

Group Policy and deployment considerations

No direct Group Policy (GPO) targets the deletion of the Windows old folder. However, you can manage it indirectly and effectively using Storage Sense policies. Here is a step-by-step process to do this:

Configure using Group Policy

  1. Open Group Policy Editor by pressing Win + R, then typing gpedit.msc. Press Enter to launch the Local Group Policy Editor.
  2. Navigate to Computer Configuration > Administrative Templates > System > Storage Sense.
  3. Configure the following:
    1. Allow Storage Sense – enable this to turn it on automatically.
    2. You can set how often Storage Sense runs (daily, weekly, monthly, etc.)
    3. Configure Storage Sense to delete previous versions of Windows. Set it to Enabled, allowing Storage Sense to delete Windows.old after a grace period.
    4. You can also fine-tune which files Storage Sense should manage.

Deploy via Intune (Microsoft Endpoint Manager)

For cloud-managed environments utilizing Intune, you can deploy this GPO using these steps:

  1. Open your browser and sign in to Microsoft Endpoint Manager Admin Center via your Microsoft 365 admin credentials.
  2. After you sign in, navigate to Devices > Configuration profiles > Create profile. 
  3. Set the following configurations:
    1. Platform: Windows 10 and later
    2. Profile type: Templates > Administrative Templates
  4. In addition, configure the following Storage Sense settings:
    1. Allow Storage Sense
    2. Run Storage Sense
    3. Delete previous versions of Windows
    4. Set cleanup frequency and retention periods

Windows.old deletion troubleshooting tips

Access denied error

When this happens, this usually means the folder is protected and you lack the necessary permissions. Ensure you’re running PowerShell or the Command Prompt as an administrator.

The file is still in use

When this happens, some components of Windows.old might still be locked by system processes. To solve this issue, you can:

  1. Open Settings > System > Recovery.
  2. In Advanced startup, click Restart now.
  3. After reboot, you’ll be directed to the Choose an option screen. Navigate to: Troubleshoot > Advanced options > Startup Settings > Restart.
  4. After your PC restarts, you will see a list of options. Press F4 to boot into Safe Mode.
  5. Once in Safe mode, you can use PowerShell or Command Prompt as an administrator to delete Windows.old folder.

Disk space is not recovered after deleting the Windows.old folder

When this happens, you can:

  • Refresh File Explorer, reboot the system, and recheck disk space.
  • Ensure the Recycle Bin is emptied, especially if you used File Explorer to delete it.

You can also use third-party tools like TreeSize Free, WinDirStat, or Disk Cleanup to verify if it was fully removed and identify large hidden folders or temporary files. However, be careful when using third-party apps; they may delete more files than intended if they are not properly configured.

Save system space by deleting the Windows.old folder

The Windows.old folder is a temporary but space-consuming remnant of system upgrades or resets. Once you’ve confirmed that the upgrade was successful and no rollback is needed, it’s safe to delete the folder to reclaim 10–30 GB of valuable disk space.

Automating this process in enterprise or VDI environments ensures cleaner deployments and more efficient use of storage resources. Use GUI tools like Storage Settings or Disk Cleanup for one-off manual deletions, and use PowerShell, Task Scheduler, or Group Policy for automated, scalable cleanup.

You might also like

Ready to simplify the hardest parts of IT?
×

See NinjaOne in action!

By submitting this form, I accept NinjaOne's privacy policy.

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).