Jump to content

Script to delete profile at log off?


Recommended Posts

Posted

Hi

 

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.

 

Richard

Posted
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. :confused:

 

I'm going to try it for all pupils at my place now that I have seen this thread. :)

Posted
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. :confused:

 

We started using that method and for some unknown reason (at the moment) it just stopped working!! still trying to work out why =(

Posted

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 :)

 

@echo off

c:

cd\

cd "c:\Documents and Settings\"

dir *.* /b /o:d > \dirs.txt

for /f "tokens=*" %%a in (\dirs.txt) do call :DelFiles "%%a"

del \dirs.txt

exit /b

 

:DelFiles %1

set Flag=0

if %1=="All Users" set Flag=1

if %1=="Administrator" set Flag=1

if "%Flag%"=="0" (

cd %1

attrib *.* -r /s

cd..

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.

Posted
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

 

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).

 

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.

 

HTH someone,

 

Chad

  • Thanks 1
Posted
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).

 

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.

 

HTH someone,

 

Chad

 

 

 

Good work chad, that very reason is why I tend do to the delete at boot time.

Posted (edited)
Good work chad, that very reason is why I tend do to the delete at boot time.

 

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!

 

I'd do the "guest user" thing, only I don't want profiles removed from laptops.

 

Cheers,

 

Chad

Edited by Chad
typo
  • 4 months later...
Posted
I do the lot. GPO setting + UPHCLEAN + DELPROF /Q /I /R.

 

Would this setup work for this scenario?

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

  • 1 month later...
Posted
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 am ETERNALLY indebted to you!!!

Posted
Domain Guests is great, BUT the profile is not saved back to the server if this is set. So don't do it on roaming profiles, otherwise you'll get complaints.

 

They are STUDENTS -- no roaming profile for them to save bandwidth. Thanks for the caution.

Posted

:)

 

I've been having hard time trying to explain what "profile" means to teachers. They assign a number on laptop so student will return back to certain laptop to retrieve their files. It is a headache for them to keep up with which laptop go to whom. I need to figure out a way to explain why students have their OWN home drive, networked to a server and that students can log in ANYWHERE as long as they kept their files on H: drive. Is there any article on Internet that introduces a non-technical audience to Windows profile and how they are different to network drive? I find explaining "A-B-C" of basic computer jargons very difficult.

Posted

As far as my teachers and students are concerned, nothing is stored on any computer and everything is stored on the servers. I demonstrate this by showing them that they can't see the C: drive in My Computer because 'it isn't there' (I know :rolleyes:) If the computer/laptop they are using can't talk to the servers, they can't access their files. I don't mention profiles and it's generally understood that anyone can log on anywhere... except the office because the computers there are different.

 

The office computers aren't different, but it keeps the office staff happy! :)

  • 4 weeks later...
  • 1 month later...
Posted (edited)
I, too, want (need) a logoff script that will selective delete LOCAL profiles - selective as I want to delete the students' local profile, but not my admin1, administrator, or the teacher's profile.

I have been looking for a method to do the same thing. We did not have this problem until we moved to Novell ZCM10.x.x. Prior to that change our students had volatile profiles (except grad students) and the profile was deleted at logoff. Now the system tries to delete the profile from Windows XP Pro at logoff. It deletes the registry entry but can not delete the directory. For that reason, when the student logs on next time it tries to create a new profile but because the directory already exists it makes a second profile such that a directory and profile now exists such as username, username.hostname.001, username.hostname.002. etc. Even admins are having that problem so even though their profile already exists it still tries to create another one and another one.

 

We do not use domains and use Novell networking as our network os. Has anyone else moved to Zen10 and run into this same problem? How were you able to delete the profile crumbs?

 

Thank you.

Edited by ChrisH
  • 2 months later...
  • 11 months later...
Posted
Domain Guests is great, BUT the profile is not saved back to the server if this is set. So don't do it on roaming profiles, otherwise you'll get complaints.

 

Thanks for the headsup!...

Is there a way to delete all the profiles AFTER they are stored/saved on a server?

 

That would help me out allot!

 

Cheers,

OND.

Posted
We run a startup script to clear the machine of profiles - that way they are saved to the server at log off but don't clog the machine.

 

36Degrees,

 

Thanks for sharing that information.

Is it possible to pm/show me that script...so we can learn from it and maybe also use?

 

Thanks,

OND.

Posted (edited)

No problem - pretty sure I found it on the web (here?) and amended it accordingly. Just amend as necessary where I've put notes (REM) and save as a batch file and run as a startup script.

 

@echo off
c:
cd\
cd "c:\Documents and Settings\" REM Path to where profiles are on the local machine
dir *.* /b /o:d > \dirs.txt
for /f "tokens=*" %%a in (\dirs.txt) do call :DelFiles "%%a"
del \dirs.txt
exit /b

:DelFiles %1
set Flag=0
if %1=="All Users" set Flag=1 REM Don't delete All Users profile
if %1=="Administrator" set Flag=1 REM Don't delete Administrator profile
if "%Flag%"=="0" ( 
cd %1 
attrib *.* -r /s
cd..
rem change rd %1 /s /q
rem for no confirmation 
rd %1 /s /q
)

Edited by 36Degrees
Posted

Thank you very much!

I appreciate it very much...i will look into it and try to configure it for our use!

 

Thanks again!

OND.

  • 1 year later...
Posted (edited)
I'm trying to implement profile deletion using the local guests account. I have added the students group to the local guest account. The student profile that is created is a temp profile, but the temp profile is not being deleted at logoff. We are not using Roaming Profiles. Any ideas why the temp profile is not being deleted? Thanks Edited by pesposit

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...