Link to home
Start Free TrialLog in
Avatar of Jerome Slaughter
Jerome SlaughterFlag for United States of America

asked on

Vbs logoff script not working from Group Policy

The facts:

1. Windows Server 2003 is where group policy is running from.

2. Have windows xp and windows 7 machines on the network.

3. I have a vbs script that (a) determines the OS for a machine (windows xp or windows 7) and then (b) cleans a user's temporary files when user logs off.
 
4. I have successfully run this script locally and from a network share folder with no problems.

5. Having problems running this same vbs script through the Group Policy.
    a. Created a global security group which falls under Users in Active Directory Users and
        Computers
    b. added a test user to the Security group
    c.  have a Group Policy Object created under the domain.
    d. within that group policy object, I added the security group i created under the security filtering.
    e. The security group has full control permissions.
     f. Edited the group policy object created and added the logoff script under User Configuration -->Windows Settings --> Scripts (Logon/Logoff).  
     g. The script has also been added to the following path when clicking "show files" in the logoff properties:  \\domain\sysvol\domain\policies\policy number\user\scripts\logoff
     h. did gpupdate  /force in cmd window on server and on client machine
      i. checked following path: C:\Users\user name\AppData\local\microsoft\windows\temporary internet files on windows 7 machine before logging off
      j. logged back on to machine. Checked following path again:   C:\Users\user name\AppData\local\microsoft\windows\temporary internet files
      k. temporary files are still present
      l. Tested the above with a couple test user accounts plus my admin account and still no success.

I have not found a similiar solution through the internet or in the experts-exchange knowledge database. Thought I would ask the question to the experts.
ASKER CERTIFIED SOLUTION
Avatar of Don
Don
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jerome Slaughter

ASKER

This Group Policy setting is a very nice to know but i'm not having any luck in getting it to work. I set the group policy setting and applied gpupdate on the server and the machine.  What temp directory is this group policy using to remove temp files? I have a windows 7 machine and am looking at the following path to see if the temp files are deleted when the browser is closed:

C:\Users\username\AppData\Local\Microsoft\Windows\Temporary Internet Files

Should I not be looking at a user specific temp folder?
Hi, since the script works when run manually, add some logging to the script that writes to a file, so that when it runs during logoff, you can see where it gets up to during its execution, and maybe where it stops.

Regards,

Rob.
dstewartjr was correct above in using Group Policy to push out the logoff script to delete user's temp file when they logoff their systems. I finally was able to get it to work through group policy by:

1. In Group Policy Management, riqht click on the default domain policy under your network domain. Note: This policy setting will get pushed out to all users on your domain who are authenticated users.

2. Right click on Default Domain Policy --> choose Edit

3. Click under User Configuration --> Windows Settings -->Scripts (Logon/Logoff)

4. Double click on logoff

5. Click on Show files button at the bottom of the window. Copy the script into that file path. Exit out of that window.

6. Back on the logoff properties screen click the add button and browse to the script file you just added in # 5 above.

7. Click ok and close out of the group policy object editor window

8.  On the Group Policy Management window at the top click action --> refresh and then close out of the Group Policy Management window.

9. Go to the command prompt and type in gpupdate /force  and press enter. The group policy is now updated on the server. You can do the same on the workstation if you like but the group policy should be updated and will push out the update to the machines on your network at it's refresh interval.
Good suggestion to use Group Policy for logoff scripts but I had to do some testing before it successfully worked for me.