Delete Windows profiles (DeleteProfiles2K8.vbs)

Various solutions exist "out there" for deleting Windows profiles; ranging from the Windows Group Policy setting "delete cached copies of roaming profiles" (doesn't work well enough to use) through scripted solutions, to custom utilities.

Previously Microsoft had a utility called "DelProf.exe" to clean up the local profile structure. However, DelProf no longer works on Windows 7 or Server 2008. Other simplistic solutions such as deleting local profile folders engender more problems than they solve by creating system inconsistencies that cause temporary user profiles to be created.

Most prominent among the custom utilities that have caught my attention is "DelProf2" by Helge Klein (see: http://www.sepago.de/d/helge/2008/10/16/deleting-a-local-user-profile-not-as-easy-as-one-might-assume ). Another tool worth looking at is "REMProf" downloadable at http://www.ctrl-alt-del.com.au/CAD_TSUtils.htm

While the above utilities may be fine, I am reluctant to install third party tools whose inner workings are not totally transparent. Putting aside my personal preferences, many of my customers are just as skeptical; hence the quest for a workable scripted solution.

At first Joe Shonk's (http://www.theshonkproject.com) DeleteProfiles.vbs script looked promising, however it fails on Windows Vista, 7 and Server 2008. The script also has flaws that cause errors to pass undetected, giving the appearance of running successfully while in fact failing.

I have tried to fix the script's major flaws while also implementing the necessary changes to fully support Windows Server 2008 and Windows 7. The script deletes local user profiles based on criteria such as age, whether it is a cached copy of a roaming profile, or name (supports custom inclusion and exclusion lists).

You can download DeleteProfiles2K8.vbs from HERE:  https://docs.google.com/open?id=0B7HBDOaiFbCVMmM1YjgxODYtMzNlNS00MzgyLWI0ZDYtZGQwNjA0YmVhYzkw
(the file extension ".TXT" has been added to circumvent Google docs' script filtering; remove the extension after downloading)


Mr.Ram said...

Thank you so much, grat job!

Anonymous said...

This is great

Thanks for the help


Marcin said...

Is it also Windows 8 compatible?

eOx said...

I haven't tested on Windows 8. My motivation for this script was use in a terminal services environment, but by all means feel free to give it a spin on Win8 and make any changes if needed :-)

Marcin said...

I used this great script in my Windows XP enviornment, although on Windows 8 it correctly founds all profiles to delete but finally none of them are removed. I don't know why because no error is produced... Could you help me?

eOx said...

Sorry, but I'm afraid I don't have time to spare to delve any deeper into this now. However, my first thought is that the problem could be a permissions issue. If you aren't already doing so, try running from an elevated command prompt.