Home  |  Services  |  About Us  |  Contact  | 


Brad's TechTips - Windows

[<< Full list of Windows tips.]
Windows: Delete Unused Profiles, Locally or on Remote Computers
You can find Delprof in the various Windows resource kits, or download from this site as a MSI file.
DELPROF [/Q] [/I] [/P] [/R] [/C:\\<computername>] [/D:<days>]
/Q Quiet, no confirmation.
/I Ignore errors and continue deleting.
/P Prompts for confirmation before deleting each profile.
/R Delete roaming profile cache only.
/C Remote computer name.
/D Number of days since profile(s) last used.
For example, the command
   Delprof.exe /I /Q /C:\\pc1 /D:90

tells Delprof to delete all the profiles that haven't been used in the past 90 days from the computer named PC1.

The /Q switch is important to include if you plan to automate the deletion process. When you don't include this switch, you must confirm that you want to delete each profile before Delprof will delete it.
To automate the deletion process, you can create a simple text file named computers.txt that contains all the names of the computers in your network that has profiles that you want to delete. You need to put each name on a separate line. After you've created this file, run the following For command from the command-shell window:
For /f %a in (computers.txt) Do
   Delprof.exe /I /Q /C:\\%a /D:90
Delprof will then delete all the profiles that haven't been used in the past 90 days from the computers specified in the text file.
Alternatively, you can place the For command in a batch file, which you can then schedule to run periodically. Note that you must replace the two occurrences of %a with %%a to use this command inside a batch file.

Code and verbiage are from an article by Apostolos Fotakelis and published in Windows ITPro Magazine.