Petri IT Knowledgebase Forums
 

Petri.co.il forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > General Scripting
Petri.co.il is happy to award auglan the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read

Notices

Logoff Script Not Running

Logoff Script Not Running

this thread has 6 replies and has been viewed 12241 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 7th December 2006, 01:42
Jason Jason is offline
Casual
Casual
 
 Join Date: Dec 2006
  6 month star 12 month star
 Posts: 15
 Reputation: Jason is on a distinguished road (10)
Default 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  
Old 7th December 2006, 09:32
syslog's Avatar
syslog syslog is offline
Casual
Casual
 
 Join Date: Nov 2006
  6 month star 12 month star
 Posts: 33
 Reputation: syslog is on a distinguished road (22)
Default 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.
  #3  
Old 8th December 2006, 00:01
Jason Jason is offline
Casual
Casual
 
 Join Date: Dec 2006
  6 month star 12 month star
 Posts: 15
 Reputation: Jason is on a distinguished road (10)
Default 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; 8th December 2006 at 00:08..
  #4  
Old 8th December 2006, 00:10
tonyyeb's Avatar
tonyyeb tonyyeb is offline
Moderator
 
 Join Date: Dec 2004
  6 month star 12 month star
 Location: Hull, UK
 Posts: 2,182
 Reputation: tonyyeb is a jewel in the roughtonyyeb is a jewel in the roughtonyyeb is a jewel in the rough (283)
Default Re: Logoff Script Not Running

Quote:
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 To grant some reputation points to the user that helped you, just click on the little Yin-Yang icon on the right of the user's answer and follow the prompt. where appropriate **
  #5  
Old 8th December 2006, 19:17
Jason Jason is offline
Casual
Casual
 
 Join Date: Dec 2006
  6 month star 12 month star
 Posts: 15
 Reputation: Jason is on a distinguished road (10)
Default 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.
  #6  
Old 8th December 2006, 20:28
JeremyW JeremyW is offline
Moderator
 
 Join Date: May 2006
  6 month star 12 month star
 Location: Washington DC metro area
 Posts: 3,309
 Reputation: JeremyW is a glorious beacon of lightJeremyW is a glorious beacon of lightJeremyW is a glorious beacon of lightJeremyW is a glorious beacon of lightJeremyW is a glorious beacon of light (497)
Default 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
  #7  
Old 8th December 2006, 20:50
tonyyeb's Avatar
tonyyeb tonyyeb is offline
Moderator
 
 Join Date: Dec 2004
  6 month star 12 month star
 Location: Hull, UK
 Posts: 2,182
 Reputation: tonyyeb is a jewel in the roughtonyyeb is a jewel in the roughtonyyeb is a jewel in the rough (283)
Default 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 To grant some reputation points to the user that helped you, just click on the little Yin-Yang icon on the right of the user's answer and follow the prompt. where appropriate **
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
force logoff on xp zilcali GPO 3 30th August 2007 19:30
Logoff script takes too much time for it's process S2002 Windows Server 2000 / 2003 4 14th February 2006 17:25
Running a Script bwebber Windows Server 2000 / 2003 1 28th October 2005 14:50
running a VB script as a service chris General Scripting 4 31st August 2005 16:31
Cannot logoff Willi123 Windows 2000 Pro, XP Pro 4 8th September 2004 03:07


All times are GMT +3. The time now is 18:50.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri