Jump to content

Recommended Posts

Posted

Hello,

 

Does anybody know how to fix the delprof2 error:

 

Deleting profile '\\*computer*\C$\Users\*StudentUserProfile*' ...Could not delete key . Error: Access is denied.

 

The tool successfully deletes the profile folder but not the registry on the machines?

 

Please note, we're using PDQ with DA Privilege's.

 

Thanks in advance :)

 

Kieran

Posted

One of my colleagues has set up a thing to collect the error log of delprof, do a takeown on every error and use it as a input to delete the error keys.

 

I just leave it, so far it has not caused me an issue.

Posted

That error has been an issue in DelProf2 for a very long time, since Windows 8 and the introduction of the Microsoft Store and Apps I believe and DelProf2 hasn't been updating in quite a number of years. It is fine to ignore it as the rest of the profile is deleted as expected.

 

Just be aware that DelProf2 doesn't work when using /d switch to only delete after x amount of days, as Microsoft changed the way that the modified dates are read.

Posted

Don't use delprof, use powershell

 

Get-CimInstance win32_userprofile | Where {$_.LastUseTime -lt $(Get-Date).Date.AddDays(-120)} | Remove-CimInstance

  • Thanks 2
Posted

Thanks for the reply's guys, we ended up coming to the same conclusion as soon as I opened this thread to read the responses.

 

The error was just throwing me off, and just had to definitely find out that the tool deletes the SID's in the correct places also.

 

Thanks for the help guys!

Posted

Great to hear! 1 week in and its really helping get rid of those pesky cached account on the 64gb notebook laptops!

 

We have this on a schedule using PDQ remove old accounts past a certain date when the device is online :)

Posted (edited)
Don't use delprof, use powershell

 

Get-CimInstance win32_userprofile | Where {$_.LastUseTime -lt $(Get-Date).Date.AddDays(-120)} | Remove-CimInstance

 

Seems to think people logged in recently in testing when i know its been a year, tried lastwritetime but its all blank on them

 

Edit: think our antivirus must be altering the dates when it scans them

Edited by ittech2342323
Posted (edited)
Don't use delprof, use powershell

 

Get-CimInstance win32_userprofile | Where {$_.LastUseTime -lt $(Get-Date).Date.AddDays(-120)} | Remove-CimInstance

 

doesnt work, lastUsetime is always current date

Edited by Lxshm
Posted

You'd have to use it with something like the below to change the modify date

 

$Dat = Get-Item "$Path\$UserName\NTUSer.dat" -force

$DatTime = $Dat.LastWriteTime

 

Don't use delprof, use powershell

 

Get-CimInstance win32_userprofile | Where {$_.LastUseTime -lt $(Get-Date).Date.AddDays(-120)} | Remove-CimInstance

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...