Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to run a script1 when a user logs in2 AND and when they log out3 on their4 Windows5 machine.


  1. Perfect world script would mean Powershell script, but any script or application would be acceptable.
  2. Log in can mean at machine start too, but user log in would be ideal.
  3. Log out can mean machine shutdown too, but user log out would be ideal.
  4. This machine is not on a domain.
  5. The Windows version is Windows Vista.
share|improve this question
up vote 9 down vote accepted

On a non domain machine you can edit the local machine policy to run scripts at startup and shut down (this may not work in Vista Home edition).

To access this go to start, run then enter gpedit.msc.

In here, expand the user configuration node, then windows settings, then you will find a scripts option where you can set the location of scripts to be run at logon and logoff.

enter image description here

share|improve this answer

Windows Vista's Task Scheduler also supports running scripts at those events.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.