RE: How to ensure a script to run when system crashes
- From: G. Sharp <GSharp@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 26 Mar 2006 14:57:59 -0800
When you say 'Crash' do you mean 'Forced Shutdown'? or System Crash (as in
Blue Screen or Complete Freeze)?
If the latter (Crash) there is no way to run some code AFTER the system has
crashed... and if you could predict your computer was about the 'Crash'
microsoft would have put some friendly message like:
'Just thought we should let you know... Your computer is ABOUT TO CRASH, so
save all your work really quick'
Maybe I'm wrong, but I dont think it works like this :P
I can think of two reasons (currently) why you might want to do this:
You perhaps want to stop all the active connections/broadcasts that occur on
a network even after a computer is turned off?
Your best bet is disabling Wake-On-Lan in the BIOS which should disable your
network adapter once the computer shuts down. If this doesn't work theres
bound to be a BIOS setting to turn LAN off after powerdown. (that or tell
your customers to unplug their computers at the end of the day (good
power-spike prevention :P lol))
Another reason you might want this is that you dont want a wireless card
authenticating (using a certificate) until a user is logged in (and the cert
becomes available). You might be able to stop this by running your disable
script on system load (before anyone logs in). You could do this several ways:
As a Service:
This would allow you to automatically detect stop/start of the computer (not
'Crash' though) as well as any power (eg. Suspend/Hibernate) events. Use
VB.NET/C#.NET 2005 - works a treat (.NET 2.0 has excellent WMI support as
well!).
In Group Policy:
In the Local Computer Policy (Run: gpedit.msc) --> Computer Configuration
--> Windows Settings --> Scripts (Startup/Shutdown)
You can add scripts which run at startup/shutdown (eg. Before a user Logs in)
You can then add other scripts for user Login/Logout:
In the Local Computer Policy --> User Configuration --> Windows Settings -->
Scripts (Logon/Logoff)
All these settings could (should) be placed over an Organisational Unit in
your Domain, allowing you to run these scripts over a group (or all) of your
workstations/users.
Hope this helps, if i've got it all wrong I apologyse.
Regards,
G. Sharp
"Lopamudra" wrote:
Hi,.
I am running wmi script to enable one of the LAN connections during system
shutdown. This is done by calling a VB exe during system startup which is
idle all the time and when the system shuts down, it tries to unload the exe
causing a certain script to get invoked (in Onunload event). This works fine
for shut down but the unload event is not called when the system crashes. Is
there a sure shot way to ensure that the script runs when the system crashes
as well.
Regards
Lopamudra Patnaik
- Prev by Date: Missing Properties? Win32_Processor/Win32_ComputerSystem
- Next by Date: Re: WPP free build problems
- Previous by thread: Missing Properties? Win32_Processor/Win32_ComputerSystem
- Next by thread: Re: How to ensure a script to run when system crashes
- Index(es):
Relevant Pages
|