Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to automatically delete user profiles?

Status
Not open for further replies.

NcCorduan

MIS
Oct 26, 2001
92
US
Hello!

We have a public computer lab here with Win2K machines -- which means we get between 100 to 200 profiles put on those machines in a week. Unfortunately, deleting all those profiles from twenty machines is a bit time consuming. So I'm trying to figure out the best way to automatically delete all the user profiles.

I tried using a batch file that just changed the attributes of All Users, Administrator, and Default User so they couldn't be deleted, but I couldn't find any way from a Windows 2000 command prompt to do the equivalent of

RMDIR /S /Q *.*

After that I tried a complex web of batch files which was designed to delete the profile of the last person who logged on. It works as long as the person logging on has administrator-level priv's over other users' profiles, but we certainly don't want our students having that level of power in a public lab. (That's the whole reason we went to 2000!)

Does anyone have any alternative ways to schedule the deletion of user profiles? Thanks!!
 
There is a registry setting you can add to all the client computers which deletes roaming profiles when the user logs off. It doesnt delete the profile if the romaing profile can not be updated on the server, or the user doesnt log off, ie. Just presses the power button on the computer without logging off/shuting down correctly.
In the registry add a DWORD Value, give it the name DeleteRoamingCache and give it a value of 1. Go to for more info.
Also there is a delprof.exe program that comes on the microsoft resource kit.
Also there is a group policy setting you can set to delete roaming profiles when a user logs off.
 
Let me clarify something...

These aren't cached copies of roaming profiles. Because of broader network policies over which I have no power, we haven't been able to impliment those yet. (If we had roaming profiles, I'd probably just make the students who use the public labs have mandatory profiles.) So what I need to delete are *local* user profiles, generated by network logins.

Would the same gimmick you mention work for that circumstance?

Thanks!!
 
adding the registry entry wont work in this situation, it only works with romaing profiles. Im not sure if delprof.exe will work with local profiles, ive never had to use delprof.exe. But its worth a try if u got the time to play with it.
 
I just decided a few minutes ago to try using DELPROF, and it works -- with one down-side. It deletes the local Administrator profile, as well as all the others. It keeps Default User and All Users, but not Administrator. In most circumstances, using one of our network accounts as a local admin is sufficient, but if the PC's not on the network, we need that local account to fix it...

I tried using

ATTRIB +H

to hide the profile and see if that would protect it, but it didn't.

Any recommendations for protecting the Administrator profile from deltion, or copying a server-cached copy of the profile out to each local PC after I've run DEFPROF?

Last time I checked, XCOPY was the only way to copy folders and subfolders and it truncated filenames, which would be a bad thing in this situation...

Any more help? :)
 
Maybe you could fiddle with he NTFS permissions so delprof doesnt have enough permission to delete the folder (i think that can be done by denying the SYSTEM account to the Administrator Profile) But the trick is to allow the Local Administrator to have enough access to update there profile.

FYI deleting the Local Administrator Profile wont stop them Local Admin from logging on to the machine. It just means there settings will be lost when there profile is deleted. When they go to log on again the profile will be recreated.
 
Thanks for all your help, SithlOrd! I learned some good stuff from you... Turns out, BTW, that in Windows 2000, they've finally improved XCOPY to the point where it correctly and smoothly handles long filenames.

Everything seems to be working! :)
 
Hi NcCorduan I have the same problem, I have set up server 2000 Xp stations and want to remove the laaast logged on profile. I have read your comments on Xcopy could you give me a clue on how you wrote a bat file using this to remove the pofile ?
Thanks Some lead, some follow....I just Hope!
 
Hi again, still trying to get this DELPROF to work on server 2000, XP stations. I have tried to get it to run using a logoff script but i think the ussser would have to have admin rights. i have also tried to get it to run from the server, with no luck. Can it be run on the station by setting a time, ie: as a service or task. Thanks all.I:) Some lead, some follow....I just Hope!
 
Hi all have now got delprof to work !!
I have put it on the server in a folder called delprof with a batch file called networkmachines. this batch file has all my networked machines in a list, ie:
delprof/Q /I /C:\\ROOMW1
delprof/Q /I /C:\\ROOMW2
delprof/Q /I /C:\\ROOMW3
delprof/Q /I /C:\\ROOMW4
delprof/Q /I /C:\\ROOMW5
delprof/Q /I /C:\\ROOMW6
delprof/Q /I /C:\\ROOMW7
delprof/Q /I /C:\\ROOMW8
etc etc and I now run this as a scheduled task from the server and it works a treat removing all the unused profiles.

Some lead, some follow....I just Hope!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top