2018-10-09: Delprof2 has issues with UWP apps on Windows 10. Why? Windows 10 stores per-user settings in per-machine database files that are exclusively locked (almost?) all of the time. I consider this a design flaw on the part of Microsoft and I am not going to waste my time trying to work around that.

Delprof2 is the unofficial successor to Microsoft’s Delprof which does not work with operating systems newer than Windows XP. Here are the main facts:

Delprof2 is syntax compatible to the original Delprof, but more powerful

Delprof2 lets you explicitly specify which profiles to delete

Delprof2 bypasses security to delete profiles regardless of current permissions/owner

Delprof2 supports very long paths

Delprof2 works on all modern versions of Windows

Delprof2 is free for personal and commercial use

What Does it Do?

Delprof2 deletes inactive user profiles. If you want to reclaim disk space just run it without parameters and it will delete all profiles except your own and some special profiles needed by the operating system (like “Default”).

Delprof2 has additional filtering options: you might want to delete locally cached copies of roaming profiles only or delete only those profiles that have not been used in a specified number of days. Delprof2 does it all, both on the local system and remotely.

Special Features

Exclusions and Inclusions with Wildcards

It is a frequent requirement to delete all profiles except one or two which should be left unchanged. With version 1.5 of Delprof2 that is easily possible: profiles can be excluded from deletion using a wildcard notation. If, on the other hand, only a few known profiles are to be deleted, use the inclusion feature and Delprof2 ignores everything else. Combining excludes and includes is possible, too, of course.

Bypassing Security

User profiles often have permissions set on them in such a way that not even administrators have access without prior ACL manipulation. Delprof2 circumvents this requirement by making use of backup and restore privileges to analyze and delete even the most tightly secured profiles.

Long Paths

Some programs store files in paths with more than 260 characters. Most tools cannot deal with such paths that are longer than the value of MAX_PATH (260). Windows Explorer is a prominent example. Delprof2, on the other hand, makes use of special APIs to be able to delete files in the remotest areas of your hard drive.

Syntax and Examples

The program’s help screen describes the available options in detail:

Delprof2 by Helge Klein (https://helgeklein.com) Delprof2 deletes inactive Windows user profiles (profiles that are not currently loaded). Delprof2 is syntax compatible with the original Delprof by Microsoft. Unlike the original it works on all modern versions of Windows. If possible, Delprof2 uses the backup and restore privileges to bypass security and delete even profiles the executing user does not normally have access to. Delprof2 has no problem whatsoever deleting files in very long paths (longer than MAX_PATH, 260 characters). Delprof2 also cleans up stale ProfileList SID.bak registry entries, a common cause of temporary profiles. Usage: delprof2 [/l] [/u] [/q] [/p] [/r] [/c:[\\]<computername>] [/d:<days> [/ntuserini]] [/ed:<pattern>] [/id:<pattern>] [/i] /l List only, do not delete (what-if mode) /u Unattended (no confirmation) /q Quiet (no output and no confirmation) /p Prompt for confirmation before deleting each profile /r Delete local caches of roaming profiles only, not local profiles /c Delete on remote computer instead of local machine /d Delete only profiles not used in x days /ntuserini When determining profile age for /d, use the file NTUSER.INI instead of NTUSER.DAT for age calculation /ed Exclude profile directories whose name matches this pattern Wildcard characters * and ? can be used in the pattern May be used more than once and can be combined with /id /id Include only profile directories whose name matches this pattern Wildcard characters * and ? can be used in the pattern May be used more than once and can be combined with /ed /i Ignore errors, continue deleting Examples: Delprof2 /c:computername Deletes inactive profiles on 'computername'. Delprof2 /c:computername /l Lists inactive profiles on 'computername' without deleting them. Delprof2 /d:30 Deletes profiles older than 30 days on the local computer. Delprof2 /r Deletes locally cached roaming profiles only. Delprof2 /ed:admin* /ed:pmiller Deletes all inactive profiles on the local computer except those starting with 'admin' and the one called 'pmiller'.

Here is an example of Delprof2 in action, deleting user profiles remotely on a Windows XP computer (Windows 7 / 2008 R2 work just as well):

D:\>DelProf2.exe -c:192.168.175.130 -p DelProf2 by Helge Klein (https://helgeklein.com) Delete inactive profiles on '192.168.175.130'? (Yes/No) y Ignoring profile '\\192.168.175.130\C$\Dokumente und Einstellungen\All Users' (reason: special profile) Ignoring profile '\\192.168.175.130\C$\Dokumente und Einstellungen\Default User' (reason: special profile) Ignoring profile '\\192.168.175.130\C$\Dokumente und Einstellungen\LocalService' (reason: special profile) Ignoring profile '\\192.168.175.130\C$\Dokumente und Einstellungen\NetworkService' (reason: special profile) Ignoring profile '\\192.168.175.130\C$\Dokumente und Einstellungen\Administrator.WINXP' (reason: in use) The following user profiles match the deletion criteria: \\192.168.175.130\C$\Dokumente und Einstellungen\administrator.HK \\192.168.175.130\C$\Dokumente und Einstellungen\Helge \\192.168.175.130\C$\Dokumente und Einstellungen\test01 \\192.168.175.130\C$\Dokumente und Einstellungen\testlocal \\192.168.175.130\C$\Dokumente und Einstellungen\testlocal2 Delete profile '\\192.168.175.130\C$\Dokumente und Einstellungen\administrator.HK'? (Yes/No) y Deleting profile '\\192.168.175.130\C$\Dokumente und Einstellungen\administrator.HK' ... ... done. Delete profile '\\192.168.175.130\C$\Dokumente und Einstellungen\Helge'? (Yes/No) n Delete profile '\\192.168.175.130\C$\Dokumente und Einstellungen\test01'? (Yes/No) n Delete profile '\\192.168.175.130\C$\Dokumente und Einstellungen\testlocal'? (Yes/No) n Delete profile '\\192.168.175.130\C$\Dokumente und Einstellungen\testlocal2'? (Yes/No) n

Changelog

Version 1.6.0 a) New features - Support for Windows 8, 8.1 and Server 2012 (R2) ================================================ Version 1.5.4 a) Bugfixes - Mandatory profiles were not detected as being in use ================================================ Version 1.5.3 a) New features - Client side rendering print provider data is now deleted, too. ================================================ Version 1.5.2 a) Bugfixes - Fixed incorrect messages "not old enough to be deleted" which happened if: profile age < time zone offset (for negative time zone offsets larger than one, e.g. the USA) ================================================ Version 1.5.1 a) Bugfixes - Version 1.5 introduced a bug which prevented Delprof2 from working on Windows XP. This has been fixed. ================================================ Version 1.5 a) New features - Inclusion and exclusion of profile directories - Delprof2 now also cleans up these registry locations: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileGuid\<GUID> [where SidString equals the current profile user's SID] HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\<SID> - NTUser.ini can be used instead of NTUser.dat for profile age calculation. This is useful if your antivirus product regularly mounts user profile registry hives, updating their timestamps in the process. - Delprof2 is now digitally signed - Changed license. Please consult the product's website for details. b) Changed features - Delprof2 needs the Remote Registry service on remote computers. Added a concise error message if the service is not started - When only listing (not deleting) permissions the text printed on the screen now clearly states that fact - The Systemprofile was ignored previously, now it is explicitly excluded (just in case) c) Bugfixes - Profiles with "access denied" were not ignored although that was printed on the screen ================================================ Version 1.0.1 a) New features - Added unattended mode (invoked with /u on the command line) where Delprof2 does not ask for confirmation b) Bugfixes - Delprof2 did not work on Vista and Server 2008 due to incorrect OS version checking

System Requirements

Delprof2 has works on Windows 7 / Server 2008 or newer.

Please note that Delprof2 comes as a 32-bit binary only, but works correctly on both 32-bit and 64-bit Windows, locally and remotely.

Download

Download Delprof2 here.