Getting Control at Shutdown

I have some scripts I want run if the machine is about to shutdown. Is it possible to launch a task on shutdown that's executes a script? If so, how much time does it have?

Ed

August 17th, 2012 11:43pm

Here is a discussion on handling Windows shutdown events.

http://stackoverflow.com/questions/148733/intercept-windows-vista-shutdown-event-in-c-sharp

Free Windows Admin Tool Kit Click here and download it now
August 18th, 2012 12:30am

You can specify a script to run on shutdown.

Assign computer shutdown scripts

You need to put into consideration what the script is doing and what happens if it is unable to finsih. Something you can adjust is the time windows will wait for it to execute.

http://msdn.microsoft.com/en-us/library/ms811643.aspx

Remember that a long ruining logoff or shutdown script can be just as annoying as a long logon or start up script.

As jrv pointed out you can also utilize .Net. I wrote a service some years back that would write the GUID for symantic to a remote share and then reload it upon start up. This was for non persistent virtual server to avoid first time scan.

Mike

August 18th, 2012 1:21am

My point exactly. You cannot control teh shutdown except AFTER it occurs.  YO ucannot cancel teh shutdown because, by the time the script is executed, the computer is nearly shutdown.

If you want to effect a user session you need to ise a logoff script.  If you need to just do some simple local or broadcast items use a shutdown script.

The computer is shutting down so you cannot start any new programs.

If we really need to control the shutdown then it is necessary to create a system service of some kind that has the ability to control the shutdown.

Free Windows Admin Tool Kit Click here and download it now
August 18th, 2012 1:30am

Did you find a other way to "intercept and block" the shutdown of the computer ?
July 8th, 2015 4:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics