I would like to have a bat file run when a user either shutdowns or logs of the PC. Currently running AD with GPO’s. I found the previous post, but the person who posted stated it didn’t work. Is there an easy way to have a bat file run when you hit shutdown or logoff?
Here is what a previous repsonse gave, but not sure if it works.
Logoff script: Add a key ‘Logoff’ under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
There, add a value ‘UserScript’ and/or ‘SystemScript’ for the file to be
executed (a batch file or an .exe, full path recommended).
UserScript is executed under the security context of the user, SystemScript
under the security context of SYSTEM.
Add an optional value ‘LogFile’ where STDOUT and STDERR and some additional
messages are piped to.
Add an optional value ‘Timeout’ (in seconds) when to terminate the script(s)
(0 or no value: no timeout).
Shutdown script: Add a key ‘Shutdown’ under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
There, add a value ‘Script’ for the file to be executed (a batch file or an
.exe, full path recommended).
The script is executed under the security context of SYSTEM.
Add an optional value ‘LogFile’ where STDOUT and STDERR and some additional
messages are piped to.
Add an optional value ‘Timeout’ (in seconds) when to terminate the script(s)
(0 or no value: no timeout).
I would definately test this on a standalone first.