Simply add this script to an OU in your domain under computer login scripts, and reboot the computers. Once they start, they’ll automagically delete all user profiles from the computer except for admin, default user, all users, etc. The script can be easily changed to suit your specific needs.
The script is here:
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
Now, remember that this does not remove registry keys related to the profiles. It is a very simple and unclean script. However, I like things a little dirty 😉
Since it’s so simple, you can easily see that you can add additional names that you would like to protect from the script. You can also easily remove names that you want it to delete. Have fun!
Leave a Reply