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
- Press
Windows Key + Rto open the Run dialog. - Type
regeditand press Enter (or click OK). - 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
- Right-click any empty space in the right pane of the
Systemkey. - Select New > DWORD (32-bit) Value.
- Name the new value
CleanupProfilesand press Enter. - Double-click
CleanupProfilesto open its properties. - Under the Base section, select Decimal.
- In the Value data field, enter the number of
inactive days (for example,
30,60, or90) after which a profile should be removed. - Click OK to save the changes.
Step 4: Apply the Settings
- Close the Registry Editor.
- 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.