Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running script or program on logoff

Status
Not open for further replies.

MatsHulten

Programmer
Dec 29, 2000
180
SE
Do anybody know of a way to run a script or program whenever I logoff my computer?
Something like the startup-folder in the program menu, only run at logoff/shutdown.

-Mats
 
Well, W2K has some pretty good features in regards to tasks such as these. You can enable a script to run either during logoff or shutdown.

The first thing to do would be to run MMC. Once up, go to the Console pull-down menu and select Add/Remove Snap-In.
Click the Add button and add the Group Policy snapin...I also add the User/Groups snapin so I have both available in the same console. Once you add them and click Ok you should see them both under Console Root.

Open the Local Computer Policy object/User Configurations/Windows Settings and highlight scripts. You should see both logon and logoff. Right click on Logoff and choose properties...you can then add a logoff script.

You can do the same to run a script at power off by going to the Computer Configuration/Windows Settings and scripts.

You can save this console so you can run it from a shortcut > console1.mmc

Doug
dxd_2000@yahoo.com

 
Super! Thanx a lot!
Now, only one problem remains... :)
The program I want to run is designed to accsess Visual Sourcesafe and find out what files/projects the user has currently checked out, and ask if the user wants to check in these before logging off.
As you see, this means I need to suspend the logoff sequence, and wait for user input before continuing, while the way you described runs the script when the GUI already has shut down.

Do you know of any way around this?

-Mats

 
A possible method would be to use policies to disable the Logoff and Shutdown menu items.

Then create a batch or cmd file that will run your sequence of programs with the final line being a call to the SHUTDOWN.EXE app that comes with the NT/2000 resource kit and create a shortcut to it on the desktop.

The shutdown utility has various command line arguments that can be used to shutdown when and how you want, e.g. specific time interval.

Let me know if you need the shutdown utility and I will email it to you.

Doug
dxd_2000@yahoo.com

 
Thanks for your input. I will have to raise the issue with our network admins.

-Mats
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top