guide · static export
PC · storage

Remove Old User Profiles and Reclaim Disk Space

Every account that ever signed in leaves a folder under C:\Users, often several gigabytes. The supported way to remove one is the WMI profile object, not a delete in Explorer.

by@guidox updated:10/31/26 time:20 min level:Intermediate tested on:Windows 11 24H2 works on:Windows 10, Windows 11, Windows Server 2019 tools:PowerShell as administrator, System Properties
TL;DR

List them with **Get-CimInstance Win32_UserProfile**, match the SID to a real account, then remove with **.Delete()** on the profile object. Deleting the folder by hand leaves registry entries and a broken profile behind.

Before you start

Requirements

  • Admin rights
  • A backup of anything still needed
  • 20 minutes
Step by step

Instructions

01

List the profiles with last use and size

**Win32_UserProfile** returns the SID, the path and the last use time. The size comes from the folder, so the two commands together show what a deletion is worth.

Get-CimInstance Win32_UserProfile | Select-Object LocalPath,SID,LastUseTime,Loaded,Special | Sort-Object LastUseTime
Get-ChildItem C:\Users -Directory | ForEach-Object { [pscustomobject]@{ Name = $_.Name; GB = [math]::Round((Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum / 1GB, 2) } } | Sort-Object GB -Descending
02

Match each SID to a real account

**Get-LocalUser** gives the SID of every local account, and the well-known SIDs for SYSTEM and the service accounts belong to Windows. Removing those breaks the machine.

Get-LocalUser | Select-Object Name,Enabled,SID,LastLogon
Get-CimInstance Win32_UserProfile | Where-Object { $_.Special -eq $false } | Select-Object LocalPath,SID,LastUseTime
⚠ warningNever remove the profile of a SID starting with S-1-5-18, S-1-5-19 or S-1-5-20. Those are SYSTEM, LocalService and NetworkService.
03

Check what is still inside before deleting

Desktop, Documents and Downloads are what people miss. A last look at the folder costs a minute; restoring a deleted profile later is not possible.

$p = 'C:\Users\olduser'
Get-ChildItem "$p\Desktop","$p\Documents","$p\Downloads" -ErrorAction SilentlyContinue | Select-Object FullName,Length,LastWriteTime
Get-Item "$p" | Select-Object FullName,LastWriteTime
04

Delete the profile through the WMI object

The **Delete** method removes the folder, the registry entry under ProfileList and the profile from the system list in one operation. That is the difference to an Explorer delete.

$prof = Get-CimInstance Win32_UserProfile -Filter "SID='S-1-5-21-1111111111-2222222222-3333333333-1002'"
$prof | Select-Object LocalPath,LastUseTime
$prof.Delete()
Get-CimInstance Win32_UserProfile | Select-Object LocalPath,SID
05

Verify the space came back

**Get-PSDrive** shows the free space before and after, and the folder must be gone. A folder that reappears means the account signed in again.

Get-PSDrive C | Select-Object Used,Free
Get-ChildItem C:\Users -Directory | Select-Object Name,LastWriteTime
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' | Select-Object PSChildName
06

Clean up the leftovers that remain

A profile that was deleted while it was loaded leaves a registry key with a state value. A **.bak** suffix under ProfileList is the usual sign of a half-removed profile.

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\*' | Select-Object PSChildName,ProfileImagePath,State
Get-CimInstance Win32_UserProfile | Where-Object { $_.LocalPath -like '*\Users\*' -and -not (Test-Path $_.LocalPath) } | Select-Object LocalPath,SID
Troubleshooting

Common issues

Delete fails with access denied

The profile is loaded. Sign out of that account, or restart and run the call before anyone signs in; a loaded profile cannot be removed.

The folder is still there after the delete

Some files were locked by a service. Restart, then delete the remaining folder by hand and clean the matching ProfileList key.

The account list still shows the user

The profile is not the account. Remove the account with Remove-LocalUser, then delete the profile with the WMI object.

A user gets a temporary profile after cleanup

The ProfileList key survived while the folder was removed. Delete the broken key and let Windows create a fresh profile at the next sign-in.

FAQ

Frequently asked

Does deleting a profile delete the Microsoft account?

No. It removes the local copy of the data on this PC. The cloud account and its files stay intact and sync again at the next sign-in.

What happens to files encrypted with EFS in that profile?

They become unreadable, because the certificate lived in that profile. Export the key before you remove an account that used folder encryption.

Can I automate this for many PCs?

Yes, with the same WMI call in a loop over the SIDs you want gone. Test it on one machine first, because a wrong SID removes a working profile.

How to undo this

A deleted profile cannot be restored. Before deleting, copy anything important to another drive, and keep a full system image if the machine has no other backup.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress