Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know that you shouldn't just delete the folder in c:\Documents & Settings (or wherever) and should also delete "something" from the registry under HKEY_USERS. We sometimes want to delete all the user profiles off a XenApp server.

Bombprof works well - looks like it's crashed at start-up but it's just busy enumurating all the profiles. You can have hundreds on a XenApp server.

But we want to try and script the operation, maybe deleting profiles that are dormant. Any tips on how to cleanup the registry side as well? I've loaded regedit as administrator and HKEY_USERS doesn't list all users. I suspect just the current loaded ones.

Cheers, Rob.

PS. Is this really a StackOverflow question as it's going to have a programming solution?

share|improve this question

1 Answer 1

The profile key you're looking for is HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList. This is a list of all cached profiles on the machine, along with the profilepath. If you delete an entry from this list along with it's corresponding folder in documents and settings (or "users" on newer OSes) it is completely removed.

The HKEY_Users and HKEY_CurrentUser registry entries are in fact stored in NTUSER.dat for each users, and this file exists in the users folder (documents and settings). So, removing the folder will effectively wipe that user's portion of the registry as well.

Shouldn't be too hard to script something around it, just make sure you don't touch the built-in user profiles such as LocalService, NetworkService and SystemProfile.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.