Pegasus [MVP] wrote:
> "Pete" <Noentry@unknownhost> wrote in message
> news:(E-Mail Removed)...
>> How can a get a batch job to pop up a message? The message has to survive
>> the PC's going to standby and waking up.
>>
>> Background:
>> My external drive's power supply failed and so my nightly scheduled
>> backup job naturally couldn't complete. However, I didn't figure this
>> out for a couple of days until I went to manually check the drive for
>> something. In case the problem happens again, I want to know sooner.
>>
>> In "Scheduled Tasks," the Last Result is 0x1, which I assume is an error
>> code (normal result is 0x0). Following my discovery, I checked "Notify
>> me of missed tasks" in the Advanced menu of Scheduled Tasks, but the
>> next morning there was no notification that I could see -- no popup on
>> the screen and no entry in the Event Viewer.
>>
>> Scheduled Task's log shows "Result: The task completed
>> with an exit code of (1)" but perhaps the task scheduler doesn't interpret
>> that as a "missed task."
>>
>> I could create a batch job that checks the Errorlevel following the
>> scheduled task, which ought to detect the 0x1 return code, but what do I
>> use for the "command" in order to get a display? The only thing I can
>> think of is
>>
>> @echo off
>> backupjob.exe
>> If not errorlevel 1 then goto end
>> cmd /k
>> echo warning -- task failed
>> :end
>>
>>
>> but that seems a bit kludgy. Any more elegant solutions?
>
> Here you go:
> @echo off
> backupjob.exe || net send %ComputerName% "Warning: Backup task failed"
>
> You must make sure that the Messenger service is running.
>
>
Thanks. I had disabled the Messenger service long ago because of some
type of spam (I forget what exactly), but I'll give this a try. Perhaps
the spammers have moved on to new technologies.
I suppose if I want to get really creative, I can shoehorn in a net
start command, leaving the Messenger service enabled but not
automatically started on boot.
|