View Single Post
  #9  
Old October 20th 17, 10:12 PM posted to alt.comp.os.windows-10
T
external usenet poster
 
Posts: 4,600
Default Outlook and shutdown question

On 10/20/2017 01:30 PM, VanguardLH wrote:
T wrote:

Originally, I asked all three of them how they wanted to schedule
their backups. Thye decided to do them manually at quitting time
with an automatic shutdown afterwards. Then proceeded to NEVER do
it.


What about defining an event in Task Scheduler that runs at quitting
time, or late Friday, or just before whenever the backups are scheduled
to run that uses the option to wait for the computer to be idle. If
they leave at 5 PM and the backup runs at 2 AM then the computer should
have already been idle for hours, probably even for someone that stays
late at the office. Else, use the "Start the task only if the computer
is idle for N minutes/hours". Although the drop-down list presented
for that option has pre-defined values, you can edit the selection field
for that drop-down control, like changing "10 minutes" to "40 minutes".
Schedule the kill event to run, say, 1 hour before the backup job, have
the event wait for the computer to go idle for, say, 10 minutes, and
have that event retry for up to 1 hour.

Task Scheduler doesn't do dependent events. That is, you cannot have an
event pend until one, or more, prior events have completed. Nor can you
have an event run or not depending on the status of a prior event.
There are other schedulers that will run events in a specific order
where you can define dependency (other event must end before starting
another, prior event must return zero status code so it ran okay, etc).
Sorry, don't remember what was that other scheduler. A company I worked
at a long time ago use it because they needed scheduled tasks to be
dependent based on several conditions. Only remembered that it cost
around $30-$40. I wrote scripts to make the events dependent in Task
Scheduler but they didn't want to rely on someone after me having to
understand batch scripts in case a modification was needed. There's
VisualCron which is pricey ($99) or very pricey (up to $9999); however,
the customers choice will be to pay you for however many hours it takes
you to roll your own interdependent scripts or pay you for less hours
and pay for a Task Scheduler alternative that can do dependencies.

Since you're using scripts, you could use system environment variables
to relay that information across scheduled events. One variable would
show the status of an event as "running" but at its very end blank,
null, or delete that environment variable. Another variable could relay
the status of the job. If the programs or scripts ran inside a script
return a status code, you could save it in a variable. Then in an event
that should run later (is dependent), you could have its script check if
the other event is still running or if it failed. While Task Scheduler
would start the 2nd event, that script would pause waiting until the
system environment variable no longer had a value of "running" or was no
longer defined. Task Scheduler would show the 2nd event as running but
the script is waiting for the 1st event to end. The 2nd event's script
could also get status from the 1st event in another variable. If the
1st event failed, probably no point in running the 2nd event, or attempt
some recovery script in the 2nd script for the failure in the 1st event.

Task Scheduler also can have an event triggered by an event. Edit an
event and go to the Triggers tab. Look at the "Begin the task"
drop-down listbox. One is to trigger by event. What that does is
monitor the event logs (what you see using Event Viewer) to detect when
a specific event occurs. The problem is, one, does a scheduled task
generate (log) an event that will show up in the event logs and, two,
will you know what is that event (event or log category, the source that
generates that event, and the event's ID).

For example, there is a 3rd party enhancement to the Windows Firewall
that adds permissions on outbound connections. The Windows Firefox, by
default, only regulates [unsolicited] inbound connections. A user found
out how to change the default of allow everything out to blocking
everything out and triggering on an event on the block to display a
prompt asking if you wanted to continue blocking, always block, or add a
rule to allow the outbound connection from whatever source. The trick
was to reconfigure Windows Firewall to block all outbound connections
(instead of allowing all), trigger on the blocked event (monitor the
event logs), and display a prompt letting the user decide what to do.
Instead of replacing the Windows Firewall, the author only needed to
write and keep loaded a small utility that monitored for the blocked
events and show a prompt. The result is very similar to 3rd party
firewalls that will prompt on an outbound connect request. While
vendors are removing support for older versions of Windows XP, this
solution continues using the Windows Firewall already there but changes
allow-all to block-all and prompt to create rules for outbound connects.
The Windows Firewall helper is at http://wfn.codeplex.com/. How it
works might give you some info on how to use events in Task Scheduler.

I also found more information on using event triggering in Task
Scheduler at an MS blog. See:

https://blogs.msdn.microsoft.com/dav...after-another/

Conditional event triggering is possible but it's not the easiest thing
to setup in Task Scheduler. I wrote scripts that made then dependent on
order and ok/error status but my company back then didn't want to
require expertise in others to maintain or modify the scripts (I was a
contract employee so I was going to be gone and they wanted to ensure
someone else could manage the scheduled jobs). I cannot remember the
name of the scheduler they paid for that had many dependencies that
could regulate the flow of scheduled jobs; however, flow management
could get so complicated with multiple dependencies that it almost
because another programming environment. My scripts would work as long
as batch files were supported in DOS and Windows (I had to stay away
from using commands that were Windows version specific).


They leave at all hours and work at all hours. 09:00 works perfectly
as it is the most likely that they will be in the office. They
arrive at 07:30 to 08:30, check their eMail, make their calls
and swear at their employees and vendors, then they go out in
the field and swear some more. (It is had not to laugh -- I
love working for these guys!). And they can not tell the
backup is happening.

These guys swear so much it takes three times as long to chew
their way through a sentence and get their information out.
It is hysterical.

"[expletive deleted] take the [expletive deleted] and [expletive
deleted] put the [expletive deleted] on the [expletive deleted]
[expletive deleted] over [expletive deleted] on the [expletive deleted]
[expletive deleted]"

You get the picture. As I said, it is hard to keep from laughing.
And they are loyal and honest as well as hysterical.

One time I was doing some warrantee work off the clock and when the
boss found out about it he said "[expletive deleted] I [expletive
deleted] am not [expletive deleted] going [expletive deleted] to
[expletive deleted] have any [expletive deleted] employee of mine
[expletive deleted] [expletive deleted] working for [expletive deleted]
free!". Now that was a first! And I did not dare not charge him!
Ads