Mr_M_Cox Posted June 13, 2007 Posted June 13, 2007 hi all, i really need a script or .bat file or something that can delete the contense of the Documents and settings folder (ie all the user profiles) on the clients machines . i would lik eto be able to do it from the server without having to go to each machines and manually select them and delete tham. if any clarification is needed let me know because i am not great at explaining my issues. cheers
tango Posted June 13, 2007 Posted June 13, 2007 You can use delprof.exe from Microsoft to remove profiles, we have it configured via group policy to run at machine startup. Just a batch file with delprof /Q /D:1 in it. Hope that helps.
ICT_GUY Posted June 13, 2007 Posted June 13, 2007 User Hive Cleanup service is the MS app you need. http://www.microsoft.com/downloads/details.aspx?familyid=1B286E6D-8912-4E18-B570-42470E2F3582&displaylang=en
Mr_M_Cox Posted June 13, 2007 Author Posted June 13, 2007 cheers guys for the responses. Tango, that script did not work it entered delprof /Q /D:PC018 delprof /Q /D:PC019 but it didnt work, if this is wrong please correct me. oh and i need it to run without me having to confirm everything it is deleting
tosca925 Posted June 13, 2007 Posted June 13, 2007 I use the script below, you can edit it to keep certain folders such as we have 'default user' administrator and all users' The chice is yours. It has worked very well for us. Function Main() On Error Resume Next Dim obtainfolder Dim PathFolder Dim strPath Set fso = CreateObject("Scripting.FileSystemObject") strPath = "C:\Documents and Settings\" Set f = fso.GetFolder(strPath) ' Loop through all subfolders For Each fldrItem in f.SubFolders fldrName = fldrItem.name If Right(strPath,1) <> "\" Then PathFolder = strPath & "\" & fldrName Else PathFolder = strPath & fldrName End If Select Case fldrName Case "Administrator": Case "All Users": Case "Default User": Case Else: set obtainfolder = fso.GetFolder(PathFolder) obtainfolder.Delete true End Select Next ' Clean up objects Set fso = Nothing Set fc = Nothing End Function call Main() 1
tosca925 Posted June 13, 2007 Posted June 13, 2007 Sorry, double post when our shi*e internet was playing up.
tosca925 Posted June 13, 2007 Posted June 13, 2007 I use the script below, you can edit it to keep certain folders such as we have 'default user' administrator and all users' The chice is yours. It has worked very well for us. Function Main() On Error Resume Next Dim obtainfolder Dim PathFolder Dim strPath Set fso = CreateObject("Scripting.FileSystemObject") strPath = "C:\Documents and Settings\" Set f = fso.GetFolder(strPath) ' Loop through all subfolders For Each fldrItem in f.SubFolders fldrName = fldrItem.name If Right(strPath,1) <> "\" Then PathFolder = strPath & "\" & fldrName Else PathFolder = strPath & fldrName End If Select Case fldrName Case "Administrator": Case "All Users": Case "Default User": Case Else: set obtainfolder = fso.GetFolder(PathFolder) obtainfolder.Delete true End Select Next ' Clean up objects Set fso = Nothing Set fc = Nothing End Function call Main()
tosca925 Posted June 13, 2007 Posted June 13, 2007 Can a admin delete these multi posts for me please.............. Bloody LEA internet. :twisted:
tango Posted June 13, 2007 Posted June 13, 2007 Sorry , was typing that off the top of my head , just checked the batch file were have for machine start up and its :- %windir%\delprof /q /i /d:0 Obviously we have delprof.exe copied to the windows dir on each PC. We also run it manually on each PC when doing a general tidy up in case the PC hasnt been rebooted for a while. I work in a Uni so there can be perhaps 20 students logging on to a PC each day so they can build up over a few days if the PC hasnt been rebooted. I have scripts to WOL all the PCs and then using psshutdown from Sysinternals pstools reboot them all , and I try to do this every so often early in the morning when nobody is logged on.
PiqueABoo Posted June 13, 2007 Posted June 13, 2007 Does anyone factor in orphans i.e. D&S folders that aren't listed in the registry and in principle won't be touched by delprof? [Don't ask me how that happens, but I've definitely seen them around]
mac_shinobi Posted June 13, 2007 Posted June 13, 2007 If you take a look at this thread from before : http://edugeek.net/index.php?name=Forums&file=viewtopic&t=405
Southerner Posted February 15, 2013 Posted February 15, 2013 hi all, i really need a script or .bat file or something that can delete the contense of the Documents and settings folder (ie all the user profiles) on the clients machines . i would lik eto be able to do it from the server without having to go to each machines and manually select them and delete tham. if any clarification is needed let me know because i am not great at explaining my issues. cheers Take a look at the VB script to delete profiles at this url: The Shonk Project
Duke5A Posted February 22, 2013 Posted February 22, 2013 You'll have to change some paths around for Windows Vista/7, but this works. You can even set folders that you don't want deleted. Call DoStuff Sub DoStuff Const LocalDocumentsFolder = "C:\Documents and Settings\" Set objFSO = createobject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(localdocumentsfolder) If MsgBox("Nuke local profiles?", vbQuestion + vbYesNo) = vbYes Then 'Do Nothing Else Exit Sub End If On Error Resume Next For Each fldr in objFolder.SubFolders If Not isexception(fldr.name) Then objFSO.DeleteFolder fldr.path, True intCount = intCount + 1 End if Next MsgBox "Operation completed. " & intCount & " local profile directories deleted." End Sub 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 "tech" isException = True case "administrator.DOMAIN" isException = True case Else isException = False End Select End Function 1
mac_shinobi Posted February 22, 2013 Posted February 22, 2013 Delprof 2 ?? http://www.edugeek.net/forums/windows-7/75098-delprof2-unofficial-successor-microsoft-s-delprof-user-profile-deletion-tool.html
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