Logoff script.

MAC_AddyMAC_Addy Member Posts: 1,740 ■■■■□□□□□□
I have created a script to be run when a user logs off, using the delprof user profile deletion tool.

I work within a school district as some of you may know.
I don't want to place this on everyones log off script on AD.

The only place that the delprof program will reside is in the computer labs (15 or more computers). The worst seems to be in the lower grades, the computers get full of profiles and then yell at you because of low disk space.

Is there a way for this script to be run locally when they log off?

Any suggestions will help.
Cheers,
Jamie
2017 Certification Goals:
CCNP R/S

Comments

  • MAC_AddyMAC_Addy Member Posts: 1,740 ■■■■□□□□□□
    Okay, this always happens.

    I ask a question, then I think about the question and answer it myself.

    I think the easiest way to do this is to use gpedit.msc on the local machine. Use a shutdown script.

    Setup an image (using norton ghost) and distribute this out.
    2017 Certification Goals:
    CCNP R/S
  • ajs1976ajs1976 Member Posts: 1,945 ■■■■□□□□□□
    Are you using AD? You could create an OU for the lab machines and add it there.
    Andy

    2020 Goals: 0 of 2 courses complete, 0 of 2 exams complete
  • MAC_AddyMAC_Addy Member Posts: 1,740 ■■■■□□□□□□
    Yeh, we're definitely using AD.

    That is a good suggestion, i'll get that a test.

    This is a good time to work on the scripts and all the tests, since the kids are out of school.
    2017 Certification Goals:
    CCNP R/S
  • BeaverC32BeaverC32 Member Posts: 670 ■■■□□□□□□□
    Can't you just apply an admin template to the OU that contains these computers? I believe there is a restriction setting that specifies not to save settings on logoff.

    User Config | Admin Templates | Desktop | "Don't Save Settings at Exit"

    Not sure if this is the same thing as what you're looking for...
    MCSE 2003, MCSA 2003, LPIC-1, MCP, MCTS: Vista Config, MCTS: SQL Server 2005, CCNA, A+, Network+, Server+, Security+, Linux+, BSCS (Information Systems)
  • SieSie Member Posts: 1,195
    Or use mandatory profiles?
    Foolproof systems don't take into account the ingenuity of fools
  • MAC_AddyMAC_Addy Member Posts: 1,740 ■■■■□□□□□□
    The easiest way to do this is:

    List the computers that are in labs in their own separate OU.
    Right click on OU
    Properties
    Group Policy
    Add the shutdown script.
    2017 Certification Goals:
    CCNP R/S
  • SieSie Member Posts: 1,195
    Just ensure that by moving them to their own OU they are now not missing needed GPO's etc that were inherited from their old OU.
    Foolproof systems don't take into account the ingenuity of fools
  • MAC_AddyMAC_Addy Member Posts: 1,740 ■■■■□□□□□□
    Y'know what.

    You're right, but i think i can't move over the current ones. It's nothing too hard.

    Now, let me ask you this.

    I know that domain takes over local account policies. What if I added the shutdown command to the local machine, an AD user logs in, shutsdown... will the local script run?

    If I'm thinking correctly, it won't run until a LOCAL user does anything. So I will eventually have to run this in AD.
    2017 Certification Goals:
    CCNP R/S
  • sprkymrksprkymrk Member Posts: 4,884 ■■■□□□□□□□
    Y'know what.

    You're right, but i think i can't move over the current ones. It's nothing too hard.

    Now, let me ask you this.

    I know that domain takes over local account policies. What if I added the shutdown command to the local machine, an AD user logs in, shutsdown... will the local script run?

    If I'm thinking correctly, it won't run until a LOCAL user does anything. So I will eventually have to run this in AD.

    Good question.
    If you apply a local group policy under the user or computer settings, as long as it is not in conflict with a site, domain or OU policy it will still work. Local group policy does not mean the same thing as local users vs. domain users (except in regards to account policies, but that's another topic).

    And remember also, the startup/shutdown scripts apply to computer objects, not user objects. Logon/logoff scripts apply to user objects, not computer objects.

    Finally, in regard to your proposed solution of running the script at shutdown, you might want to verify it works. I see a possible issue with rights. Are admin rights needed to delete profiles? In most cases yes. Can a profile in use (the one logging off) be deleted? No. I think it would be easier to run a Scheduled Task from an administrative machine (by a user with admin rights) that will remotely delete profiles that haven't been used in a week or so. Have a text file with the computer names and have something like this run once per day:

    FOR /F %%C IN (C:\SCRIPTS\LABCOMPUTERS.TXT) DO DELPROF.EXE /Q /C:\\%%C /D:7

    Good luck!
    All things are possible, only believe.
  • BeaverC32BeaverC32 Member Posts: 670 ■■■□□□□□□□
    The easiest way to do this is:

    List the computers that are in labs in their own separate OU.
    Right click on OU
    Properties
    Group Policy
    Add the shutdown script.

    Is it really the easiest way? It just seems it would be easier to implement a solution that already exists, rather than to reinvent the wheel.
    MCSE 2003, MCSA 2003, LPIC-1, MCP, MCTS: Vista Config, MCTS: SQL Server 2005, CCNA, A+, Network+, Server+, Security+, Linux+, BSCS (Information Systems)
  • NinjaBoyNinjaBoy Member Posts: 968
    I use a VBS script that deletes all profiles, except for certain ones on, on the PC start-up (thru AD group policy) as I found out that some profiles don't get deleted if I assigned it to the PC shut-down or user log-off (unknown why didn't want to spend too much time on this one). :)

    -ken
Sign In or Register to comment.