none
How to run a Vbscript at Logout/Shutdown without using GPEDIT???

    Question

  • Hi all,

    I have lots of pc's which are not in a domain, which i need to run a vbscript on locally when they logoff/shutdown.

    Manually, on the local machine if I go to gpedit.msc, user config, windows settings, scripts, logoff, if i add my script there it works perfectly.

    However if I manually edit the registry keys under HKLM and Local Users for the logoff keys, and also edit the scripts.ini file under c:\windows\system32\group policy\user\ and then go back into gpedit I can see that my script is added, but when logging off it does not run.

    My question is, can anyone please help me, and point out which keys in the registry need changing to allow me to achieve the same result as manually going to gpedit and adding a logout script.

    I am using windows 7 as the OS on the clients.

    I've hunted all over the web looking for a solution, so hoping technet can help.

    Thanks,
    sharpy
    Wednesday, March 10, 2010 9:45 PM

Answers

  • Yes, you're right, I didn't read the question properly. Sorry. Late night.

    You sound like you know what you're doing. Perhaps you could have your script just create the entry in group policy. That should achieve the same end result(automation). Unless you just want to specifically do it this way.

    Andrew.
    Guy who doesn't read questions, right.

    Monday, March 22, 2010 1:49 AM
    Moderator

All replies

  • I don't have W7 here so can't say for sure, but in XP there are two ways of doing this use the shell command "shutdown" or :

    Private Declare Function
    ExitWindows _
                  Lib "User32" Alias "ExitWindowsEx" _
                  (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long

    Thursday, March 11, 2010 9:31 AM
  • Windows Vista/7 now use "Local Group Policy Objects"

    This gives you many functions similar to working in a domain environment.

    Read about the new tools here: http://technet.microsoft.com/en-us/library/cc731745.aspx

    What you need to do is here: http://technet.microsoft.com/en-us/library/cc753583.aspx

    Andrew.
    MCITP:Enterprise Support Technician

     

    Saturday, March 20, 2010 12:28 PM
    Moderator
  • Andrew,

     

    Thanks for your very PC reply, but if I wanted to use Local Group Policy why would I have posted my message? Did you read my question before posting your standard support technician templated reply???

    I want to achieve the same thing as you would do in Local Group Policy, but need to know what keys are changed when someone manually does a change in local Group Policy to run a script at logoff...

    Your links do not explain what i wish to achieve. READ THE ORIGINAL POST and try again!!!

    Saturday, March 20, 2010 3:46 PM
  • Yes, you're right, I didn't read the question properly. Sorry. Late night.

    You sound like you know what you're doing. Perhaps you could have your script just create the entry in group policy. That should achieve the same end result(automation). Unless you just want to specifically do it this way.

    Andrew.
    Guy who doesn't read questions, right.

    Monday, March 22, 2010 1:49 AM
    Moderator
  • Hi Rk56, 

    I also have the same requirement. Are you successful in this? If so, please publish the steps / scripts. 

    Thanks.

    Thursday, May 23, 2013 6:40 AM
  • If this remains unresolved, check the following,

    http://www.jhouseconsulting.com/2008/08/26/scripting-updates-to-the-gptini-for-the-local-group-policy-39

    Excellent article by JEREMY 

    Friday, May 24, 2013 12:07 PM