Delete old user profiles

Posted: Tuesday, November 18, 2014 11:06:12 AM(UTC)


Member Original PosterPosts: 251
This action can be used to delete old user profiles from a remote computer.

This example deletes all user profiles not used in the last 180 days.

The tool can be downloaded from the Microsoft website:

Copy "delprof.exe" to your action folder.

{actionpath}delprof.exe /q /i /c:\\{smartname} /d:180
#1ukaussi Member Posts: 11  
posted: 12/10/2014 10:40:49 PM(UTC)
Does this work in Win7 as I thought it only worked up to XP?
#2Michael.V Member Original PosterPosts: 251  
posted: 12/11/2014 10:10:56 AM(UTC)
from the Microsoft site:

Delprof.exe is a command-line utility that you can use to delete user profiles on a local or remote computers running Windows 2000, Windows XP, and Windows Server 2003.
#3sukaitsu Member Posts: 54  
posted: 12/11/2014 2:19:34 PM(UTC)
It works fine on our clients!

Tested on:

Windows XP
Windows Vista
Windows 7
Windows 8
Windows 8.1
Windows Server 2003
Windows Server 2008
Windows Server 2008R2
Windows Server 2012
Windows Server 2012R2

Thank you,

#4Dogeron Member Posts: 7  
posted: 12/16/2014 12:32:08 PM(UTC)
I use delprof2 which you can find at

I like to have feedback so my action is :

{actionpath}\delprof2.exe /u /i /c:\\{smartname} /d:90

for those that don't just use the /q :

{actionpath}\delprof2.exe /u /i /q /c:\\{smartname} /d:90

#5BulmersheTech Member Posts: 10  
posted: 3/25/2015 11:47:06 AM(UTC)
Also using delprof2. Just tweaked a little to give a timeout on the command window.

Create a delprof2.cmd file in the Actions folder

@echo off

set PSPATH=\\path-to-your-actions-folder
set PC=%1

%PSPATH%\delprof2.exe /u /i /c:\\%PC% /d:90

timeout 10

The Action then becomes:-

{actionpath}\delprof2.cmd {smartname}

#6dkaczoro Member Posts: 3  
posted: 5/10/2016 5:28:26 PM(UTC)
Trying to use delprof2 as an action in the new Lansweeper and am running across an Access Denied that I never used to get in the old Lansweeper. I click on the action and the Helge Klein window pops up, I say Ok and get the command prompt with the request to delete inactive profiles and type "Y" and really quick before the CMD disappears, I see an Access is Denied message.

Have tried as Built-in user, target workstation Administrator and server Administrator.

action I'm using is: {actionpath}\delprof2.exe /p /c:\\{smartname}

Also tried making delprof2 a deployment option as we have a group of PCs that regularly get bogged down with roaming profiles and being able to clean those as a deployment option would be awesome but so far no luck with that script - just doing a simple one-step CMD script below

{actionpath}delprof2.exe /c:\\{smartname} /r

(have tried it without {actionpath} as well as without the "/c:\\..." trigger and get an "Incorrect function" each time.)

Would appreciate any help with either of these if possible!
#7BOFSD Member Posts: 2  
posted: 5/19/2016 10:06:41 PM(UTC)
I ran into a similar issues launching the script. Ultimately, I used @BulmersheTech 's script with a couple tweaks. I had to share the default actions folder with my domain admin service account and enable remote registry access via GPO.

I migrated my Lansweeper server from a lab environment to production, so I also had to change the default action path in Lansweeper configuration page.

Here's my cmd file:

@echo off
set PSPATH=\\<network path to action folder>
set PC=%1
%PSPATH%\delprof2.exe /c:\\%PC% /d:90 /ntuserini /ed:admin* /i
timeout 20

Increasing the timeout helped troubleshoot the remote registry access error.
#8ws6togo Member Posts: 1  
posted: 4/7/2017 6:36:26 PM(UTC)
What happens to the local Admin account when these scripts are run? We have a local admin account that only IT has the password to perform various administrative functions.
#9warlock1663 Member Posts: 15  
posted: 9/7/2017 7:14:30 PM(UTC)
Can someone tell me exactly how you get these to work? Sorry for the stupid question but I am fairly new to this aspect of LS. I jest need to know what to save the file as and where I put it to get it to work. Even if there are instructions somewhere I can be pointed to.

#10rcopestick Member Posts: 2  
posted: 9/13/2018 2:10:35 PM(UTC)

I also need some help installing this action and applying it to a number of computers on our network.

#11Esben.D Member Administration Posts: 2,055  
posted: 9/14/2018 8:36:49 AM(UTC)
You can create new actions in configuration\Asset Pages.

Do be aware that this is a quite old topic, so I can't guarantee that the original post still works.
#12DaveDischord Member Posts: 3  
posted: 7/30/2019 6:18:28 PM(UTC)
I like this Action, but anyone have any thoughts on how to use AD to delete the Disabled user profiles, rather than by age?

Active Discussions

Installer Installing Windows 10 on Win 7?
by  MCBowman   Go to last post Go to first unread
Last post: 8/11/2021 9:08:51 PM(UTC)
Installer Toast Message - Reboot Computer When Patched
by  Andy.S  
Go to last post Go to first unread
Last post: 8/11/2021 12:18:30 PM(UTC)
Installer Microsoft Teams Cache Deletion
by  baritonechimpanzee   Go to last post Go to first unread
Last post: 8/5/2021 4:35:48 AM(UTC)
Installer Install Windows Updates Powershell Script
by  Mvino   Go to last post Go to first unread
Last post: 8/4/2021 3:58:03 PM(UTC)
Installer Stop Print Spooler Service
by  Esben.D  
Go to last post Go to first unread
Last post: 7/16/2021 2:43:23 PM(UTC)
Installer Java Uninstall Deployment
by  Rodrigo Varela  
Go to last post Go to first unread
Last post: 7/1/2021 9:49:00 AM(UTC)