delete user profile .bat

February 9, 2010 at 16:29:12
Specs: Windows XP, 4 gb

i am trying to create a batch file that deletes all users in C:\Documents and Settings\
but i would like to keep these profiles

Administrator
All users
default user
installuser
testuser

but i cant make the batch file without having it delete them, if anyone can help with this i need to figure it out asap,


See More: delete user profile .bat

Report •


#1
April 16, 2010 at 03:05:22
I found a script.. buts its VBS.. I used it on 100 workstations and it works perfect!

----------------------------------------------------------------

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

SET objFSO = CREATEOBJECT("Scripting.FileSystemObject")
SET objFolder = objFSO.GetFolder(localdocumentsfolder)

ON ERROR RESUME NEXT

FOR EACH fldr in objFolder.SubFolders
	IF NOT isexception(fldr.name) THEN
		objFSO.DeleteFolder fldr.path, TRUE
	END IF
NEXT


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

----------------------------------------------------------------

save it as a .vbs file


Greetz,,
Chrys


Report •
Related Solutions


Ask Question