How can I remove the home folder for a deleted user on windows 7?

  • In Control Panel → System click Advanced system settings.
  • In the User Profiles group click Settings….
  • Select the entry labeled "Account Unknown".
  • Click Delete.

You can directly load the User Profiles dialog by running the following command:

rundll32 sysdm.cpl,EditUserProfiles

You can also use WMI for deleting orphaned profile folders, e.g. via PowerShell:

Get-WmiObject Win32_UserProfile -Filter 'RefCount=0' | ForEach-Object {
    $_.Delete()
}

Tags:

Windows 7