Running program at shutdown?

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Running program at shutdown?

Post by Me_again » Mon Dec 15, 2008 11:12 pm

Does anyone have experience with automatically running a program/macro at pc shutdown?

I found the Windows Group Policy Editor, which can apparently do this, but I'm wondering there are third party utilities or other solutions.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Dec 16, 2008 3:23 am

Macro Scheduler is the answer.

Make a script to run the exit programs you want, then last command will be to logout/exit Windows.

Make a shorcut on the Start Menu to Exit Windows and train that they should choose that icon vs. the normal Shut Down icon.

I don't have the details handy, but you can use the Policy Editor to remove the normal Shut Down Windows icon, so only yours will be there.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Dec 16, 2008 2:03 pm

Thanks, I've done shutdown scripts before but never tried to replace the windows shutdown. Good thought, if I can make that work it would be perfect.

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Dec 16, 2008 2:07 pm

Group Policy Editor is simplest. You can set it to run a .bat file. So you could create a .bat file to run a Macro Scheduler script/exe.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Dec 16, 2008 4:04 pm

Thanks, you're right, despite the "turn your pc into a doorstop" warnings I see on the web, the Group Policy Editor is easy to use, it will run a .exe directly. A registry backup is probably a good idea though.

Unfortunately it runs the script/exe towards the end of the shutdown sequence and doesn't solve this particular problem of needing to pre-emptively kill a process that stalls shutdown - so it's back to the drawing board :cry:

PepsiHogatwork
Newbie
Posts: 2
Joined: Wed Apr 08, 2009 4:29 pm

Post by PepsiHogatwork » Thu Apr 16, 2009 12:08 pm

How about this. Make the macro that you want to run at shutdown, cancel the shutdown process. There is a slash option in the shutdown command to cancel shutdown. After your macro finishes then it could execute shutdown itself. I haven't used this option in a while, but I'm sure it will be simple to find.

May seem wierd to do it this way, but it would work perfectly with the idea
of editing the Group Policy Editor to execute your macro, which would then cancel shutdown, do its thing, and re-issue the shutdown command.

The great thing about doing it this way is you never have to think about it again. 8)
PepsiHog@work

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Apr 16, 2009 12:48 pm

There is a slash option in the shutdown command to cancel shutdown. After your macro finishes then it could execute shutdown itself. I haven't used this option in a while, but I'm sure it will be simple to find.
Of the top of my head I think this is it.

Code: Select all

Run>shutdown.exe -a

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts