Windows Thread, Script to delete profile at log off? in Technical; Hi
I know this will sound silly but will you not have to put it in a start up script. ...
3rd March 2010, 02:56 PM #46
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.
3rd March 2010, 03:01 PM #47
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.
3rd March 2010, 04:23 PM #48
@ 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.
Last edited by cookie_monster; 4th March 2010 at 10:27 AM.
4th March 2010, 11:02 AM #49
Originally Posted by Gibbo
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.
4th March 2010, 11:57 AM #50
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.
4th March 2010, 01:47 PM #51
I dont run the delprof as a gpo script I run a set of bat files that does one room each when the network is quiet.
Its not fancy but I get the benefit that it cuases less inpact on the network and users get a faster log on.
4th March 2010, 02:00 PM #52
I'm going to try it for all pupils at my place now that I have seen this thread.
Originally Posted by Gibbo
5th March 2010, 12:32 AM #53
We started using that method and for some unknown reason (at the moment) it just stopped working!! still trying to work out why =(
Originally Posted by Gibbo
9th March 2010, 05:52 PM #54
This works for me with XP
I use this script as a startup script which I just added into a blank GPO. It deletes all cached profiles on machines leaving out the ones that I need to keep. It ignores any hidden profiles such as 'Default User' by default anyway :)
cd "c:\Documents and Settings\"
dir *.* /b /o:d > \dirs.txt
for /f "tokens=*" %%a in (\dirs.txt) do call :DelFiles "%%a"
if %1=="All Users" set Flag=1
if %1=="Administrator" set Flag=1
if "%Flag%"=="0" (
attrib *.* -r /s
rem change rd %1 /s /q
rem for no confirmation
rd %1 /s /q
If there are a lot of cached profiles then the first run of this may take 5 - 6 minutes. second runs though are almost instant.
9th March 2010, 10:00 PM #55
I'll just add for the benefit of others that the shonk script is now working very well, the ability to exlude profiles untill a certain age is very usefull.
The Shonk Project - Delete Profiles Script v1.9
15th March 2010, 03:11 PM #56
I found the reason why this was happening to PCs here: the ATI Hotkey Poller service (of all things!) was maintaining a lock on the profile folder and wouldn't let go, even after the user logged off. I tried to stop the service manually but the option was greyed out, so I switched it to manual to prevent it running in future (and have now got the startup script to do so).
Originally Posted by mrbios
We've some non-ATI machines showing the same behaviour so I'll investigate those at some point.
I used process explorer to find the offending file - after logging off, I immediately logged back on again and used process explorer to find anything with a lock to the previous profile folder (which was now empty) and ati2evxx.exe showed up.
Thanks to Chad from:
cookie_monster (15th March 2010)
15th March 2010, 03:15 PM #57
Originally Posted by Chad
Good work chad, that very reason is why I tend do to the delete at boot time.
15th March 2010, 03:37 PM #58
Yep, I'm using a combo of "all the above" options (delprof, UPHC service, and cleanup scripts for when delprof fails), with the scripts and delprof running during startup. It still bugs me as to why it was happening though so I was glad to get to the bottom of it!
Originally Posted by cookie_monster
I'd do the "guest user" thing, only I don't want profiles removed from laptops.
Last edited by Chad; 15th March 2010 at 03:37 PM.
29th July 2010, 10:31 PM #59
- Rep Power
Two Groups. Teachers and students.
Would this setup work for this scenario?
Originally Posted by ajbritton
I have teachers on roaming profiles I do want them to be able to keep their profile but I want to delete profiles older than 6 months (to start).
I have Students who only use lab computers and have roaming profiles, I do not want their profiles to be saved on the local pc.
We have a AD Domain and I would like to use GPO's as much as possible. Can the UPHCLEAN.msi and the delprof be pushed out and work as I have previously stated I needed? I have not used delprof or upclean before so I am a little leary about using them
17th September 2010, 06:08 PM #60
- Rep Power
I am ETERNALLY indebted to you!!!
Originally Posted by rvdmast
By Mr_M_Cox in forum Scripts
Last Post: 22nd February 2013, 04:53 PM
By FN-GM in forum Scripts
Last Post: 17th November 2007, 10:04 PM
By philtomo-25 in forum Scripts
Last Post: 1st November 2007, 04:50 PM
By roland in forum How do you do....it?
Last Post: 20th September 2007, 10:43 PM
By tosca925 in forum Scripts
Last Post: 31st August 2005, 08:45 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)