Delete ntuser.dat for non-existent user

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I deleted a user in Local Users and Groups but forgot to delete the users'
profile via the System control panel applet. Deleting the user did not
remove the users NTUSER.dat file and when I try to delete it (while logged in
as a different user with Admin rights) it always complains the file is in use.

What's the best way to delete these files? (NTUSER.dat.log as well)?

Thanks -- Peter
 
Peter Ritchie said:
I deleted a user in Local Users and Groups but forgot to delete the users'
profile via the System control panel applet. Deleting the user did not
remove the users NTUSER.dat file and when I try to delete it (while logged
in
as a different user with Admin rights) it always complains the file is in
use.

What's the best way to delete these files? (NTUSER.dat.log as well)?

Rename the file.
It then will not be in use the next time you boot

(...well it works for me)
 
Peter,

As you are a C# MVP I would suggest you use the MoveFileEx API with the:

Const MOVEFILE_DELAY_UNTIL_REBOOT = &H4 (VB) constant

For the first paprameter in the API pass the file path to the dat file & then
use NULL (to delete) for the second parameter

Run with F5 in Visual Studio & reboot when ready

Simple
 
Back
Top