Delete Stale User Profiles Automatically via Regedit

Over time, shared and multi-user Windows computers accumulate unused local user profiles that consume significant drive storage. Windows includes a built-in mechanism to automatically detect and purge user profiles that have remained inactive for a specified threshold. This guide explains how to enable and configure the automatic deletion of stale user profiles after a set number of days using the Windows Registry Editor.

Step 1: Open the Registry Editor

  1. Press Windows Key + R to open the Run dialog.
  2. Type regedit and press Enter (or click OK).
  3. If prompted by User Account Control (UAC), click Yes to grant administrative permissions.

Step 2: Navigate to the Windows System Policy Key

In the Registry Editor address bar, paste the following path and press Enter:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System

Note: If the System key does not exist under Windows, right-click the Windows folder, select New > Key, and name it System.

Step 3: Create and Configure the Cleanup Value

  1. Right-click any empty space in the right pane of the System key.
  2. Select New > DWORD (32-bit) Value.
  3. Name the new value CleanupProfiles and press Enter.
  4. Double-click CleanupProfiles to open its properties.
  5. Under the Base section, select Decimal.
  6. In the Value data field, enter the number of inactive days (for example, 30, 60, or 90) after which a profile should be removed.
  7. Click OK to save the changes.

Step 4: Apply the Settings

  1. Close the Registry Editor.
  2. Restart the computer to apply the policy.

Once configured, the User Profile Service will check for inactive profiles upon system startup and automatically remove any profile directories whose last-used timestamp exceeds the configured day threshold. Setting the value to 0 or deleting the CleanupProfiles DWORD will disable this feature.