Clean up user profiles with DelProf2


Today I started getting reports of users getting “The User Profile Service Failed the Login“. After some research on two or three of the affected machines, it was obvious what the problem was. Free space. The drives on these laptops were almost full due to these new laptops having only 32GB SSD drives and the fact that 25-50 users had signed into these machines since they were put into use. These machines were supposed to have been assigned to specific users so this would not happen. Sigh, you know how well some people listen.


I decided to use a Group Policy to copy a program to each machine and setup a scheduled task to run to remove user profiles that haven’t been used in a while.

The program I am going to use is DelProf2 by Helge Klein. DelProf2 can be used to remove user profiles either locally or remotely based on name and or profile age on windows XP or newer. Check out the link above to find out more about this program.

Step 1: Create a new Group Policy or choose an existing one.

Step 2: Edit your policy and add a task.

Go to Computer Configuration / Preferences / Control Panel Settings / Scheduled Tasks. Right-click and create a new scheduled task. I will be selecting (Scheduled Task At least Windows 7) since my machines are all Windows 8.1 & 10 otherwise my task will not show up on the machines.

Step 3: Enter your task sequence name and description.

Enter a name and description for your scheduled task. Check the box to Run with highest privileges as we will be deleting protected files and folders. Change the Configure for: to Windows 7, Windows Server 2008R2. Choose the System account to run this task.

Step 4: Set your Trigger action

Click on the Triggers tab and set the schedule when you want this task to run.

Step 5: Enter your action info

Click on the Actions tab and specify the path to the delprof2.exe file. Add whatever arguments you want to use based on your situation. I will be using the following because I want to delete any profile that starts with a number and that hasn’t been used in 30 days.

/u /d:30 /ed:public /id:0* /id:1* /id:2* /id:3* /id:4* /id:5* /id:6* /id:7* /id:8* /id:9*

NOTE: Read the docs or run delpro2.exe /? from a command prompt to see the arguments.

NOTE: DelProf2 is smart and knows not to delete certain profiles such as the following.

  • All Users (reason: special profile)
  • Default User (reason: special profile)
  • LocalService (reason: special profile)
  • NetworkService (reason: special profile)
  • Administrator (reason: special profile)

You can specify specific profiles to delete or not to delete. (See Docs)

Step 6: Enter any additional settings

Click on the Settings tab and click on Allow task to be run on demand. This will allow you to test the task sequence or run it manually whenever you want.

Step 7: Remove when not Applied

You should always check the “Remove this item when it is no longer applied” check located in the Common tab of the scheduled task, to make the GPP remove the scheduled task if your machine is moved to another Organizational Unit (OU) where this policy may not be applied.

In step 5 you specified the path to your file. Make sure you either copy the file to this location on the local machine or specify a network share which can be reached.

I will be adding a step to the same policy to copy this file to the local machine so this task can be run even if the machine is not connected to the domain.

Go to Computer Configuration / Preferences / Windows Settings / Files.

Right click and choose New File. Enter where you will copy this file from and where you want the file copied to on the local machine.

Once again choose the “Remove this item when it is no longer applied” check located in the Common tab.

Make sure you apply this policy to the appropriate group(s).

We are done!


About The Author

I have worked in the computer repair field since the early '90s. I was a technician and then Coordinator of Computer Repair for Regional Education Service Agency II (RESA 2) for 18 years. I currently work for Wayne County Schools as a Network Engineer/Technology Specialist. I am responsible for the schools' Internet access, Wi-Fi, networks, servers, laptops, desktops, and operating systems and software.

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + = 10