
I had also tried the Task Scheduler and logon works, but logoff do not work.

This runs as the local system account.įirst is first, thanks for pointing that with GPEDIT.MSC (manually installed on Windows Home) can be added Startup, shutdown, logon and logoff scripts.īut, how can that scripts (logon & logoff) be run with elevaled admin rigths?

Shutdown Runs after logoff and only as part of the machine shutting down. Logoff Runs as the users session is logging off (whether shutting down or logging off to change user) and executes as the user logging off This executes as the user who is logging on. Logon Runs as soon as a user has entered their password. Startup scripts execute as the local system account You can also follow the User Config > Windows Settings > Scripts (Logon/Logoff) to setup scripts which run at logon and logoff. Within here, you can choose to select scripts which will run on your machine as part of startup/shutdown. Once this is loaded, go to the following path:Ĭomputer Configuration > Windows Settings > Scripts (Startup/Shutdown) > Shutdown (See Below)

To do this, go to your local group policy editor (Click Start, type gpedit.msc in the Start Search box, and then press ENTER.) The easiest way to do this is with a local group policy.
