Delete Local Profiles in XP Script

If you wish to clear the profiles on a computer for any reason here is a script i wrote that will do this. If you wish to do this every time the computer is shut down you can add the script to the a group policy.

The Code

Const LocalDocumentsFolder = "C:\Documents and Settings\"

set objFSO = createobject("Scripting.FileSystemObject")
set objFolder = objFSO.GetFolder(localdocumentsfolder)
Dim FirstLetter

on error resume next

for each fldr in objFolder.SubFolders
if not isexception(fldr.name) then
objFSO.DeleteFolder fldr.path, True
end if
next

'This section allows you to add exceptions to what folders are being deleted. I have added default admin account, all users and default user.
Function isException(byval foldername)
select case foldername
case "All Users "
isException = True
case "Default User "
isException = True
case "Administrator"
isException = True

case Else
isException = False
End Select
End Function




Disclaimer: By using any of the software mentioned in this document you are adhering to their terms and conditions of use. I do not accept any responsibility for any loss, damage or disruption to your data or computer system that may occur while using the software mentioned in this document.
Site Map | Privacy Policy | Contact Us
| Best viewed in 1024 * 768 or above | ©2008 www.MyPcHealth.co.uk