Windows (and other OSes) lets you run scripts when it starts or stops, or when a user logs on or off. I use the StartUp & LogOn events to configure my RamDisk, but that's mainly for historical reasons (the RamDisk software I used to use didn't have a Windows Service option).
Does anybody use this feature, and if so, for what?
StartUp, LogOn, LogOff, and ShutDown Scripts
Moderator: Site Mods
StartUp, LogOn, LogOff, and ShutDown Scripts
-Thracx
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen
Tangentially, I remember once being frustrated by wanting to run certain things only upon Wakeup from Sleep (as opposed to Startup or Logon), and after lots of experimentation came up with this:
Effectively used as a means of (for example) forcing (permanently running) email-clients to check for mail immediately upon wakeup, rather than waiting for their normal timeout cycle to reoccur... which could be any number of minutes, depending on when the computer was put to sleep (humanely) in the first place.
I'm not sure if the task scheduler allows for this now in an easier form or not (it never used to)... but I had more fun figuring out how to do it manually rather than actually having a practical purpose for it at the time. (I'm easily amused. )
Code: Select all
Option Explicit
Dim wmiPowerManagementEvent, oShell
Const cntEventEnteringWakeup = 7
Set wmiPowerManagementEvent = GetObject("winmgmts:").ExecNotificationQuery("Select * from Win32_PowerManagementEvent")
Do
If wmiPowerManagementEvent.NextEvent.EventType = cntEventEnteringWakeup Then
set oShell=createobject("WScript.Shell")
oShell.Run """" + "{Insert Programme to Run on Wakeup Here}" + """"
End If
Loop
I'm not sure if the task scheduler allows for this now in an easier form or not (it never used to)... but I had more fun figuring out how to do it manually rather than actually having a practical purpose for it at the time. (I'm easily amused. )
Nice, might come in handy sometime with my HTPC - thanks!Kilmatead wrote:...upon Wakeup from Sleep...
And behold - you've discovered the Meaning of Life!!!Kilmatead wrote:...but I had more fun figuring out how to do it manually rather than actually having a practical purpose for it at the time. (I'm easily amused. )
(Seriously - enjoying while learning, one of the best uses of time!)
-Thracx
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen