| Remove all profiles from XP on startup |
| Written by Terry Watts | |
| Tuesday, 10 April 2007 | |
|
Occasionally Windows XP manages to stuff up its roaming profile, when this happens, resolving profile related problems can be difficult. Schools running Community Connect 3 will benefit from the "Reset Profile" option in the System Management Console, however, profile problems may quickly return, as they often remain on several workstations. To help cure this problem on an RM Community Connect 3 network, there is a system in place called station tidy. This is supposed to clean user profiles when they reach a certain age, however there have been reports that this does not work correctly. So to to ensure that a users profile problems will not return is not guaranteed. There is however a possible answer. It is a quick and dirty(ish) script that will delete all folders in C:\Documents and Settings, with the exception of system folders that are quite important. The script has been coded taking advantage that the computers "System" account has full control of all files and folders in the Documents and Settings folder. Why not use the Microsoft DELProf utility? Yes why not indeed. Through personal experience I have found that the DELProf utility doesn't always delete stale user profiles, it seems quite random and doesn't explain why it has left profiles that are clearly over x number of days old. This is particulary the case when a domain account has been deleted. If you are having problems with profiles building up on your workstations, then this might help. Note however that this only deletes folders from the Documents and Settings folder on the hard disk and does not attempt to clean up the Windows Registry that also contains references to the profile folders. The Script below will NOT work with Windows Vista, this is because the security features of Vista prevent the deletion of the User profiles folders. There is a Group Policy setting that will do a similar job to DELProf that you can switch on: Computer Config > Admin Templates > System > User Profiles >Delete User profiles older than X days.
When the script first runs, Windows XP will appear to hang on the "Running Computer Scripts" message, this is normal as it will have several hundred folders and files to delete. The code is quite rough and is quite lazy in the way that it was coded. If you need to exclude more profiles, you need to add an If Then End If block containing the name of the profile you wish to skip. The script could also be modified so that folders that are x number of days old are deleted, rather than everything. If you felt exceptionally talented, you could add code to tidy up the Windows Registry so that all traces of the profile are removed from the computer. The key to tidy is HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList ON ERROR RESUME NEXT
|