PaulBedford Posted October 10, 2008 Posted October 10, 2008 I run this batch file on startup using machine GPO. (Not log off, sorry) Have been doing it for donkeys. We have a user naming convention for all students whereby username starts with year of entry (e.g 08 this year ) leaves the other profiles I want to keep (none student) on the PCs. ---------------- @echo off c: cd\documents and settings for /f %%f IN ('dir /b 03*; dir /b 04*; dir /b 05*; dir /b 06*; dir /b 07*; dir /b 08*; dir /b 09*') DO rd /s /q %%f ----------------- 1
Popular Post rvdmast Posted October 11, 2008 Popular Post Posted October 11, 2008 One really doesn't need to use batch files, delprof, GPO's or commercial utility's, the answer is really simple: make the users member of the group "Domain Guests" or the local Guests group, and their profiles will be deleted immediatly after logoff automatically. This functionality is built-in by design. They can still remain in the domain users group too, so it won't affect their rights. 11
mac_shinobi Posted October 11, 2008 Posted October 11, 2008 kills all known pofiles. dead what about unknown ones ? lol
Gatt Posted October 11, 2008 Posted October 11, 2008 Not sure what the policy is but noticed that our Windows 2008 Server/Vista systems are automatically deleting all profiles automatically (at logoff!) - bit annoying at times but great for the kids & teacher accounts and saves me having to run DELPROF at machine boot!
box_l Posted October 12, 2008 Posted October 12, 2008 i use this in one of my logon scripts 'function to delete profiles Function Delprof() On Error Resume Next Dim obtainfolder Dim Pathfinder Dim strPath Set fso = CreateObject("Scripting.FileSystemObject") strPath = "C:\Documents and Settings\" userexcludelist = "Administrator,All Users,Default User,localservice,networkservice," Set f = fso.GetFolder(strPath) ' Loop through all subfolders For Each fldrItem in f.SubFolders fldrName = fldrItem.name If Right(strPath,1) <> "\" Then Pathfinder = strPath & "\" & fldrName Else Pathfinder = strPath & fldrName End If If InStr(1, userexcludelist, fldrName, 1) Then Else set obtainfolder = fso.GetFolder(Pathfinder) obtainfolder.Delete true End If Next ' Clean up objects Set fso = Nothing Set fc = Nothing just edit the excludelist to allow for profiles you wish to keep. but the rules still apply, you cannot delete ones in use. this seems to include all the ones used since the machine booted, not just the logged on one. BoX 1
rvdmast Posted October 22, 2008 Posted October 22, 2008 Here's another method that also doesn't need batch files, delprof, GPO's or commercial utility's, but i haven't verified this method myself: If you want cached profiles to be deleted automatically, add a REG_DWORD value named DeleteRoamingCache to HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon. Give it a value of 1 to enable removal, or 0 to allow cached profiles to stay around.
frosty Posted October 16, 2009 Posted October 16, 2009 One really doesn't need to use batch files, delprof, GPO's or commercial utility's, the answer is really simple: make the users member of the group "Domain Guests" or the local Guests group, and their profiles will be deleted immediatly after logoff automatically. This functionality is built-in by design. They can still remain in the domain users group too, so it won't affect their rights. Trawling through this site stumbled across this and it works like dream - thanks
mrbios Posted October 16, 2009 Posted October 16, 2009 One really doesn't need to use batch files, delprof, GPO's or commercial utility's, the answer is really simple: make the users member of the group "Domain Guests" or the local Guests group, and their profiles will be deleted immediatly after logoff automatically. This functionality is built-in by design. They can still remain in the domain users group too, so it won't affect their rights. The most useful piece of information i've found by accident in a long long long long time!
CraigM Posted October 19, 2009 Posted October 19, 2009 One really doesn't need to use batch files, delprof, GPO's or commercial utility's, the answer is really simple: make the users member of the group "Domain Guests" or the local Guests group, and their profiles will be deleted immediatly after logoff automatically. This functionality is built-in by design. They can still remain in the domain users group too, so it won't affect their rights. I'm going to test this first chance I get, as this would be incredibly useful to avoid clutter on the local computers. This is something the Zenworks client does at the moment, but as we moving away from Netware next year, I needed something to do the same function.
mrbios Posted October 19, 2009 Posted October 19, 2009 I've only come across one issue during testing so far, when a user logs out it removes the profile, then 10seconds later it reappears but the only thing that is in there is "local settings > application data" and it's empty, the next time that same user logs in it creates a folder "user.DOMAIN" (where the username is user and your domain is domain etc) and when the user then logs out that folder is removed completely but still leaving the original empty user folder Anyone come across this yet? not much of a problem as it's only 0 bytes but would be nice to have it gone
Vinny Posted January 20, 2010 Posted January 20, 2010 Hi There is it possible to grab a copy of the script from you.
Griff Posted February 9, 2010 Posted February 9, 2010 One really doesn't need to use batch files, delprof, GPO's or commercial utility's, the answer is really simple: make the users member of the group "Domain Guests" or the local Guests group, and their profiles will be deleted immediatly after logoff automatically. This functionality is built-in by design. They can still remain in the domain users group too, so it won't affect their rights. This is brilliant thanks a lot!!
Chad Posted February 15, 2010 Posted February 15, 2010 Anyone come across this yet? not much of a problem as it's only 0 bytes but would be nice to have it gone I'm seeing this exact issue, sometimes there's an index.dat file left behind too which is locked, but usually I see empty profile folders amassing with an increment in the numeric suffix each time. I've got a GPO setting to delete the temp IE files, not sure if this and the profile removal are clashing or if it's something else...
Tsilver Posted February 19, 2010 Posted February 19, 2010 I recently started using script written by Joe Shonk to replace the function of the Delprof.exe tool and so far am happy to report it works like a charm. It allows a lot of customization, which is nice. Here is the link to the script with all the details and instructions The Shonk Project - Delete Profiles Script v1.9 Here is a link that describes a good way to use this script locally if you don't use active directory J House Consulting / Script to replace Delprof.exe I use Active Directory and run the deleteprofiles.vbs script at the machine startup via Group Policy and I also use Microsoft's UPHClean to ensure all users profiles are unloaded just in case. Overall this method has worked best for me.
cookie_monster Posted March 2, 2010 Posted March 2, 2010 I recently started using script written by Joe Shonk to replace the function of the Delprof.exe tool and so far am happy to report it works like a charm. It allows a lot of customization, which is nice. Here is the link to the script with all the details and instructions The Shonk Project - Delete Profiles Script v1.9 Here is a link that describes a good way to use this script locally if you don't use active directory J House Consulting / Script to replace Delprof.exe I use Active Directory and run the deleteprofiles.vbs script at the machine startup via Group Policy and I also use Microsoft's UPHClean to ensure all users profiles are unloaded just in case. Overall this method has worked best for me. I'm having a play with the Shonk script at the moment but I can't get it to run as a startup script, i've got a .bat file in netlogon along with the .vb file. I can run it by pasting the command in to the cmd prompt or by double clicking it. This is the command that i'm running. Should I need to call it from a .bat file or am I barking up the wrong tree? cscript.exe %logonserver%\NETLOGON\DeleteProfiles.vbs /E root,libraryuser /D 2 /R /L C:\delprof.log Thanks. p.s I know i've got the read only switch set
frosty Posted March 2, 2010 Posted March 2, 2010 I had an issue like this once and it turned out to be the permissions on the .bat itself! - maybe worth a check?
cookie_monster Posted March 2, 2010 Posted March 2, 2010 (edited) I had an issue like this once and it turned out to be the permissions on the .bat itself! - maybe worth a check? I think i've just sorted it. The %logonserver% variable doesn't seem to work in a startup script I put a server name in and it runs file now. EDIT Ah i've remembered now. \\domainname\netlogon works and it picks a random DC Edited March 2, 2010 by cookie_monster
coop1984 Posted March 3, 2010 Posted March 3, 2010 You may find that the GPO to delete cached profiles will not work if for instance a child pulls the power from a computer when they are still logged on.
cookie_monster Posted March 3, 2010 Posted March 3, 2010 Is anyone using the Shonk Delete Profiles Script v1.9? I've been trying it and every part seems to work well except the delete part (shame that). I've set it to log and it runs through the reghives then selects profiles that can be deleted it then says "Deleting Orphaned Profile Directory: C:\Documents and Settings\USERNAME" in the log but when I check the folder is still there. I can manually delete the folder so it doesn't seem to be a permissions issue.
pwds Posted March 3, 2010 Posted March 3, 2010 If you're running this as a logon/logoff script then it will run with the permissions of the user account. In that case it's much better to run it as a startup or shutdown script (we do shutdown) as that will run with system account permissions. Sorry if this is stating the obvious.
ricki Posted March 3, 2010 Posted March 3, 2010 Hi I know this will sound silly but will you not have to put it in a start up script. As far as i know some parts of profiles and locked until the computer reboots, so if you put it in a log off or shutdown script would some bits not be left. Richard
cookie_monster Posted March 3, 2010 Posted March 3, 2010 I'm running it as a startup script so it should run as system. I have another script that just deletes every profile other than admin etc and that works i'm assigning them the same way so i'm sure i've got that set right.
cookie_monster Posted March 3, 2010 Posted March 3, 2010 (edited) @ pwds & ricki, are you both using this script? Ok i'm going to keep an eye on it, it seems to be not deleting what it terms 'orphaned directories'. I'm not sure if these are ones where it can't find a corresponding SID or not, i've set it to delete profiles that are more than one day old so we'll see tomorrow. Update: Ok I checked the log again this morning and it is deleting profiles older than the date I set but for some reason it skips what it considers to be an ‘Orphaned Profile Directory’. I’m not sure why that is perhaps the first time it ran it didn’t find a reghive entry for it. The log lists these profiles as being deleted but they never go, I’m not that bothered if from now on it keeps deleting profiles that are older than 2 days. Edited March 4, 2010 by cookie_monster
cookie_monster Posted March 4, 2010 Posted March 4, 2010 Can I just ask why nobody seems to be using the method described by rvdmast that I quoted in my earlier post? It works for me and doesn't need any batch files or scripts. The script I’m using doesn't delete a profile until it's a certain age, I set staff PC's to 21 days so they always have a local profile allowing fast logon but if they move rooms or leave their profile is eventually cleaned up. I set class PC's to 1 day so if a client crashes sometimes we can recover temp files or we can look for cookies etc if we're trying to track problems down, if we immediately delete the profile this is all lost.
pwds Posted March 4, 2010 Posted March 4, 2010 With scripts we can set the staff machines to delete profiles older than 30-90 days and student machines after seven. We actually do it on the machine basis and not the user. That way we're not constantly recreating and deleting profiles (adding to login time etc.) but also don't have a year's worth of profiles on each HDD. Combine this with a scheduled defrag and it helps keep the machines more sprightly.
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