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 particularly 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.\r\n
- On the file server, open Active Directory Users and Computers.
- Browse to the Organisational Unit that contains the computers that you wish to clear the profiles from. (Do NOT put this at the domain level, as this will then run on your domain controllers and produce undesirable results)
- Right Click on the Organisation Unit and choose the properties menu.
- Choose the Group Policy Tab, and click the New button.
- Give the policy a meaningful name “Delete Profiles from Workstations” for example
- Double click on to edit the new policy.
- Browse to Computer Configuration -> Windows Settings -> Startup/Shutdown Scripts -> Startup
- Right click on the empty part of the Group Policy Editor to add a new file.
- Click on the Show Files button.
- Now create a file called “cleanprofiles.vbs”
- Edit the file and paste the code from below (tip: copy it into wordpad first so that it retains formatting)
- Save and close the file.
- Back in Group Policy Editor, click on the Add button and select the script that you created.
- Close Group Policy.
- Allow the policy to propgate through the network then reboot the workstations. It may require 2 reboots before the script runs.
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 ' Clears user profiles on computer startup ' leaves the following folders ' Administrator ' RM Default User ' Default User ' All Users ' ClassMate ' Reference : http://msdn2.microsoft.com/en-us/library/9kcx47hd.aspx dim oktodelete, fso, f, foldercollection set fso = CreateObject("Scripting.FileSystemObject") set f = fso.getfolder("C:\\Documents and Settings") set foldercollection = f.subfolders for each folder in foldercollection oktodelete = true if instr(1, folder.path, "Administrator") then oktodelete = false end if if instr(1, folder.path, "RM Default User") then oktodelete = false end if if instr(1, folder.path, "Default User") then oktodelete = false end if if instr(1, folder.path, "All Users") then oktodelete = false end if if instr(1, folder.path, "ClassMate") then oktodelete = false end if if instr(1, folder.path, "LocalService") then oktodelete = false end if if instr(1, folder.path, "NetworkService") then oktodelete = false end if if oktodelete then 'wscript.echo "Deleting Folder : " & folder.path fso.deletefolder folder.path, true end if next