CleanRoamingProfile.vbs

Roaming profiles can cause slow logon and logoff times. Over time each users roaming profile will increase in size until it becomes so large and/or contains so many files that logon times will become noticably affected [Loading your Personal Settings...]

This script will delete selected files from the user profile of the account currently logged on. Typically it would be run as part of a logon script. The script normally runs in a fraction of a second, it displays the elasped time so you can see exactly how long it takes.

Rather than clearing out everything, this script deletes files based on their last modified date.

By default it is set to delete cookies over 90 days old, 'Recent document' shortcuts over 14 days old and cached Internet Explorer, Flash & Java files over 5 days old. You can of course edit the settings to suit your environment.

For compatibility with both XP and Vista/Windows 7 the script detects the OS and clears out the appropriate User Profile folders.

This script will delete files - make a backup before running it on any live system.

The performance benefits of reducing the profile folder size may not appear until the second time the script is run. For example for a user with 1000 recent document shortcuts the script might parse through 1000 files, keep the most recent 200 and delete the rest. That process will likely be slower than just copying all 1000 files. However the next time the user logs on they will see a faster logon with fewer files needing to be processed.

Copying a large number of small files can take a disproportionately long time due to disc cluster sizes and SMB limitations. This is why Temporary Internet Files are excluded from roaming profiles by default.

On a typical user profile the script should run to completion in less than a quarter of a second.