Procedure

Clean old Windows user profiles

Remove unused local Windows profiles safely by inventorying Win32_UserProfile, excluding special or loaded profiles, protecting user data, and using supported profile removal instead of deleting folders manually.

Objective

Remove unused local Windows profiles safely by inventorying Win32_UserProfile, excluding special or loaded profiles, protecting user data, and using supported profile removal instead of deleting folders manually.

Prerequisites

  • Local or remote administrative access and the exact Windows edition/build involved.
  • Enough free space and a recovery path for any repair or cleanup action.
  • Administrative access appropriate to the system being changed or diagnosed.
  • A clearly identified scope: affected users, systems, addresses, services and the time of the observed problem.
  • A maintenance or test window when the procedure can affect production traffic or availability.
  • A copy of the current configuration or other recovery material before any irreversible action.

Step-by-step procedure

1

Establish the baseline and scope

Before changing anything, reproduce the issue or document the requested change on a representative system. Record the affected users or services, exact time, current configuration, recent changes and a known-good comparison point. This baseline is the reference used to decide whether each later step improves the situation.

Expected result
  • The scope and current state are documented well enough to reproduce or verify the procedure.
2

Inventorying Win32_UserProfile

Work through this operational element in a controlled sequence: inventorying Win32_UserProfile. Record the current state, verify dependencies, perform the smallest necessary action, and validate its effect before continuing. If the result differs from the expected state, stop and reassess rather than stacking additional changes.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
3

Excluding special or loaded profiles

Work through this operational element in a controlled sequence: excluding special or loaded profiles. Record the current state, verify dependencies, perform the smallest necessary action, and validate its effect before continuing. If the result differs from the expected state, stop and reassess rather than stacking additional changes.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
4

Protecting user data

Work through this operational element in a controlled sequence: protecting user data. Record the current state, verify dependencies, perform the smallest necessary action, and validate its effect before continuing. If the result differs from the expected state, stop and reassess rather than stacking additional changes.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
5

Supported profile removal instead of deleting folders manually

Work through this operational element in a controlled sequence: supported profile removal instead of deleting folders manually. Record the current state, verify dependencies, perform the smallest necessary action, and validate its effect before continuing. If the result differs from the expected state, stop and reassess rather than stacking additional changes.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
6

Validate the complete service

Repeat the original user, system or application workflow from the real source and verify the complete result, not only one command or one local check. Confirm that logs and monitoring show the expected behavior and that no temporary debug, bypass, test account, rule or maintenance setting remains enabled.

Expected result
  • The end-to-end service works or the remaining failure is isolated to a clearly identified component.

Technical commands from the original procedure

These technical blocks are preserved byte-for-byte from the historical procedure and kept in their original order. Review names, addresses, paths and parameters before use.

Technical block 1
Get-Volume -DriveLetter C | Select Size,SizeRemaining
Technical block 2
Get-ChildItem C:Users -Directory -Force | Select Name,FullName
Technical block 3
Get-CimInstance Win32_UserProfile | Select LocalPath,SID,Loaded,Special,LastUseTime
Technical block 4
Get-CimInstance Win32_UserProfile | Where-Object {-not $_.Special} | Export-Csv C:Tempprofiles-before.csv -NoTypeInformation -Encoding UTF8
Technical block 5
Get-LocalUser -ErrorAction SilentlyContinue | Select Name,Enabled,LastLogon
Technical block 6
quser
Technical block 7
Get-CimInstance Win32_UserProfile | Where-Object {$_.LocalPath -eq 'C:Users<USER>'} | Select LocalPath,Loaded,Special
Technical block 8
$Profile = Get-CimInstance Win32_UserProfile | Where-Object {$_.LocalPath -eq 'C:Users<USER>' -and -not $_.Loaded -and -not $_.Special}
Technical block 9
$Profile | Select LocalPath,SID,LastUseTime
Technical block 10
$Profile | Remove-CimInstance
Technical block 11
Get-CimInstance Win32_UserProfile | Where-Object {$_.SID -eq '<SID>'}
Technical block 12
Test-Path 'C:Users<USER>'
Technical block 13
Get-Volume -DriveLetter C | Select SizeRemaining

Validation

The procedure is validated when:

  • The original symptom or change request has been tested end to end.
  • The effective configuration matches the intended design and no unexplained error remains in the relevant logs.
  • Temporary troubleshooting controls have been removed and monitoring remains normal.
  • The result, evidence and any follow-up action are documented.

Rollback

  • Restore the configuration, policy, binding, route, credential assignment or service state recorded in the baseline when the change does not meet its success criteria.
  • Remove temporary rules, test objects and diagnostic settings that were introduced only for the procedure.
  • After rollback, repeat the minimum health checks to confirm that the previous service level has been restored.

Troubleshooting / common errors

  • Correlate Event Viewer, service state and resource usage with the exact time of the symptom.
  • A repair command that completes successfully does not by itself prove the original application issue is resolved.
  • If the result changes between tests, compare source, destination, identity, time and policy context before changing additional settings.
  • If a command succeeds but the application still fails, continue at the next protocol or application layer instead of widening access.
  • If the expected evidence is missing, verify that logging, auditing and the test path actually cover the failing component.
  • If the change does not improve the measured symptom, restore the previous state and reassess the working hypothesis.

Official and vendor references preserved from the original procedure

♡ 0