• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3513
  • Last Modified:

Delprof Selective Profile Delete

Good evening,

Is it possible to selectively deny profile deletion through Delprof at command prompt without prompting e.g. the local administrator account? I want to automate profile deletion for profiles not used within 180 days but do not want several local profiles to be deleted. The only other alternative I have is to write a VBScript but why if delprof is available?


1 Solution
Try this out...
(you don't have to use delprof)

@echo off&&cls
echo Cleaning profiles ...
for /f "tokens=*" %%a in ('dir "%AllUsersProfile%\.." /b') do (
if not "%%a"=="<AnotherAccountYouWantToKeep>" ( if not "%%a"=="Administrator" ( if not "%%a"=="All Users" rd /q /s "%AllUsersProfile%\..\%%a" 2>NUL )
echo Done.
echo New profiles list :
dir "%AllUsersProfile%\.." /b
Barnardos_2LSAuthor Commented:
and235100: How does this differentiate profiles not used within 180 days?
It doesn't. Sorry - misread the question.
If you want this specification - you will need to use delprof.

You could create a script that automatically logs in as the local administrator every now and again - so the folder is modified, and therefore not deleted by delprof.

FYI: http://support.microsoft.com/kb/315411 (syntax)

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Apologies that wasn't ideal - but thank you in any case.
Feroz AhmedSenior Network EngineerCommented:
Hi ,
You can Inactive that account by specifying this command delprof /D (Here "D" specifies Number of days of Inactivity for that particular account ).
We setup the domain administrator account and service accounts not to have server based roaming profiles. We set all users to have roaming profiles. We run delprof with the /r option limiting it to only the roaming profiles, thus not touching admin or service accounts. We do not use roaming profiles for administrator for several reasons, the key being Group Policey pushes all info needed for admin profile to work and when using the admin account seeing profile settigns form teh local box is often helpful introubleshooting.


Free Command-line Utility to Delete Local User Profiles - REMPROF

REMPROF is a command-line utility to delete local user profiles that are NOT

in use when this command is executed

The awesome Warren Simondson of Ctrl-Alt-Del IT Consultancy, has released

another killer FREE Microsoft Terminal Services / Citrix utility.  REMPROF

was written to replace the command DELPROF.EXE currently found in the MS

Windows Resource Kit. This utility offers extra features that will be of

benefit to all admins. REMPROF has the ability to delete user profiles on

the local machine based on age, username, or SID association. If a username

has been deleted from a Domain or Workgroup,  the profile often still exists

with only a SID assigned to identify it.  REMPROF can delete these profiles

completely from the file system and registry regardless of the profile age,

and without removing existing profiles of the same age.


This tool could be simply run from the command line at any time, or added as

a SCHEDULED TASK for regular cleaning of user profiles, reducing the overall

disk space used for locally based profiles.  


REMPROF will only function when executed by a user with ADMIN rights to the

profile directory.



REMPROF [/LIST|username|/A|/D:days|/AD:days] [/?]


 /LIST    - List all user profiles currently not in use (Default).

  username - Delete user profile based on username.


/A       - Delete all user profiles that have no username association

             i.e. The username has been deleted in Active Directory but

             a profile still exists in form of a SID.


/D:days  - Delete all user profiles equal to or older than the number of

             days specified. NB: /D: without a number is equal to /D:0.

             /D:0 will remove CURRENT user profiles not in use.


/AD:days - Delete all user profiles that have no username association

             and are equal to or older than the number of days specified.

             NB: /AD: without a number is equal to /AD:0.


 /?       - show this help file



REMPROF without parameters will execute the /LIST switch by default.


This application has been tested on the following platforms:

·          Windows 2003 Server SP1

·          Windows 2003 Server SP1 w/ Citrix PS 4.0

·          Windows 2003  Server SP1 (Terminal Server Application Mode)

·          Windows 2000  Server SP4

·          Windows 2000  Server SP4 w/ Citrix MF XP

·          Windows 2000  Server SP4 (Terminal Server Application Mode)

·          Windows 2000  Server SP4 w/ Citrix MF 1.8

·          Windows XP Professional (domain member)


This utility is FREEWARE and was written by Warren Simondson of Ctrl-Alt-Del

IT Consultancy, Australia. www.ctrl-alt-del.com.au


Although written for Terminal Server and Citrix environments, this

application will function on non-TS/Citrix workstations and servers.



Click to download the Free Command-line Utility to Delete Local User

Profiles - REMPROF

URL to download REMProof Util


or Kindly download Remprof.doc and rename it to remprof.exe

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now