firefighting Posted July 15, 2008 Posted July 15, 2008 Anyone got a script or a quick way of deleting all the local profiles that build up on a workstation remotely or logged on as admin? VB or batch file would be great. Maybe adding it to "Admin Bar" project section! I did find something but it did not work TIA
craigg Posted July 15, 2008 Posted July 15, 2008 Try something like this: It might not be perfect so test it on your test machine before using it live. If anyone has any changes they think they could make post away! 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 "LocalService" isException = True case "NetworkService" isException = True case "Administrator" isException = True case Else isException = False End Select End Function 'Uncomment msgbox for notification 'msgbox "Local Profiles Deleted","16","WARNING" Let me know how you get on anyway. 3
firefighting Posted July 15, 2008 Author Posted July 15, 2008 Please ignore this post. Found all the necessary answer in a search on edugeeks. I did not look deep enough. ff
TechMonkey Posted July 15, 2008 Posted July 15, 2008 Delprof. Run it remotely and it works wonders. /Barry Scott BANG and the profiles are gone 1
firefighting Posted July 15, 2008 Author Posted July 15, 2008 yep! this script worked very well. Thank you craigg. I found it more selective than delprof. Thanks once again ff:)
sven Posted April 27, 2011 Posted April 27, 2011 Don't think I've ever seen a script work so well! Many thanks!
bio Posted April 28, 2011 Posted April 28, 2011 wrote an article on my blog a couple of months ago: Cleaning up student profiles on Windows XP machines « Knowledge for all (and free) ! perhaps its usefull bio..
Arthur Posted April 28, 2011 Posted April 28, 2011 If anyone has any changes they think they could make post away! Would it be possible to delete the user profiles listed in the registry to avoid Windows getting confused? How Do Users Get Their Profile? The way in which users get their profiles depends on the type of profile they're configured to use. This section describes this process. Roaming Profile - New User The user logs on. The path to the users roaming profile is retrieved from the user object on the Domain Controller. Windows checks to see if a profile exists in the roaming path, if no profile exists a folder is created. Windows checks the list of user profiles located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList to determine if a cached copy of the profile exists. If a local copy of the profile is not found, and the computer is part of a domain, Windows checks to determine if a domain wide default profile exists in the Default User folder on the domain controllers NETLOGON share. If a domain wide profile exists, it is copied to a subfolder on the local computer with their user name under %Systemdrive%\Documents and Settings\. If a default domain profile does not exist, then the local default profile is copied from the %Systemdrive%\Documents and Settings\Default User folder to a subfolder on the local computer with their user name under %Systemdrive%\Documents and Settings\. The users registry hive (NTUSER.DAT) is mapped to the HKEY_CURRENT_USER portion of the registry. The users %userprofile% environment variable is updated with the value of the local profile folder The user can then run applications and edit documents as normal. When the user logs off, their local profile is copied to the path configured by the administrator. If a profile already exists on the server, the local profile is merged with the server copy (see merge algorithm later in this paper for more details). (Source)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now