Announcement

Collapse
No announcement yet.

Logoff Script Not Running

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logoff Script Not Running

    I have a simple logoff scipt to delete the contents of the Temp folder applied in group policy. It runs fine when applied locally or from the command line, but not when applied through gp. It is in the right folder but just never runs. I checked the registry and there are no keys listed that indicate the script knows to run. Nothing happens even after the client computer says 'running logoff scripts'.

    Contents of deletetempfiles.bat

    @echo off
    del /s /q /f c:\temp\*

  • #2
    Re: Logoff Script Not Running

    This is not related to this forum, but anyway...

    "checked the registry and there are no keys listed that indicate the script knows to run" - what do you mean by that?

    Some few points:

    1. If you appiled the script as a COMPUTER log-off script you might want to check if the COMPUTER account has permissions to delete files from that directory.

    2. Where is the script stored? If it is stored in a share, you might want to check that the COMPUTER account has permissions to read data from there (in case you are using log-off script).

    3. I would add a line that writes to the event log (in the script you can use EventCreate) to see if the script really loads or not.

    Regards,
    Syslog.

    Comment


    • #3
      Re: Logoff Script Not Running

      Considering that it involves a script I would say it is, but anyway...

      The Group Policy script's CSE determines which scripts to add or delete and stores this information in registry keys. There are four different registry keys of interest, one each for startup, logon, logoff, and shutdown.

      • HKLM\SOFTWARE\Policies\Microsoft\Windows\System\Sc ripts\Startup

      • HKLM\SOFTWARE\Policies\Microsoft\Windows\System\Sc ripts\Shutdown

      • HKCU\Software\Policies\Microsoft\Windows\System\Sc ripts\Logon

      • HKCU\Software\Policies\Microsoft\Windows\System\Sc ripts\Logoff


      You will see them only when Group Policy scripts exist for your Active Directory user or computer account and since the keys have not been added to any of the client machines I assumed that the script is not running and the CSE is not editing the registry to point to the location of the script. The question is why?

      To answer your other points:
      1)That is a good point which might affect some of the users, but even when administrators log in the script does not execute.

      2)The script is stored on the Primary Domain Controller. Looks something like...
      \sysvol\(domainname)\Policies\{id number}\User\Scripts\Logoff

      I made sure to click the Show Files button in the Logoff Properties dialog box in group policy and stored the script in the folder it opened.

      3)Good idea, but wouldn't using EventCreate imply the use of VBS? I was trying to keep it in DOS just for simplicity.

      Thanks for the help.

      Also, I tried adding it as a logon script to avoid the worries of user permissions, but still no luck.
      Last edited by Jason; 7th December 2006, 22:08.

      Comment


      • #4
        Re: Logoff Script Not Running

        Originally posted by syslog View Post
        1. If you appiled the script as a COMPUTER log-off script you might want to check if the COMPUTER account has permissions to delete files from that directory.

        2. Where is the script stored? If it is stored in a share, you might want to check that the COMPUTER account has permissions to read data from there (in case you are using log-off script).
        Log off scripts are a USER setting NOT computer. Computer scripts include startup and shutdown. Users have log on and log off scripts.

        @Jason: The user in question has to have the log off script applied to it and as such must be in the OU where the gp is applied... not the computer.
        Server 2000 MCP
        Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

        Comment


        • #5
          Re: Logoff Script Not Running

          The script is saved in the gp of the OU I want it to apply to but still nothing. I tried applying it in the gp of the domain and in the gp of the OU with no results.

          Comment


          • #6
            Re: Logoff Script Not Running

            Run RSoP in logging mode. See if the policy is being applied properly.
            Regards,
            Jeremy

            Network Consultant/Engineer
            Baltimore - Washington area and beyond
            www.gma-cpa.com

            Comment


            • #7
              Re: Logoff Script Not Running

              Or try gpresult on the workstation and with the user being applied to.
              Server 2000 MCP
              Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

              ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

              Comment

              Working...
              X