How to run a Vbscript at Logout/Shutdown without using GPEDIT???
-
Wednesday, March 10, 2010 9:45 PMHi 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
All Replies
-
Thursday, March 11, 2010 9:31 AMI 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 -
Saturday, March 20, 2010 12:28 PMModerator
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- Proposed As Answer by Andrew BarnesModerator Saturday, March 20, 2010 12:31 PM
-
Saturday, March 20, 2010 3:46 PM
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!!!
-
Monday, March 22, 2010 1:49 AMModerator
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.- Marked As Answer by IamMredMicrosoft Employee, Owner Thursday, March 25, 2010 2:01 AM
-
Thursday, May 23, 2013 6:40 AM
Hi Rk56,
I also have the same requirement. Are you successful in this? If so, please publish the steps / scripts.
Thanks.
-
Friday, May 24, 2013 12:07 PM
If this remains unresolved, check the following,
Excellent article by JEREMY

