Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Does the standard Win98 Task Scheduler have a COM interface?

Posted on 2005-04-11
14
Medium Priority
?
1,537 Views
Last Modified: 2013-12-29
I want to address the Win98 Task Scheduler, if possible using CreateObject from VB. Does it have a COM-interface, and, if it has one, how to call the various functions or objects??
0
Comment
Question by:Sjef Bosman
  • 7
  • 5
13 Comments
 
LVL 16

Assisted Solution

by:dhsindy Sparrow
dhsindy Sparrow earned 400 total points
ID: 13755101
Task Scheduler is a component of Internet Explorer and has been since version 4.01.  The exact name I will have to look it up tonight at home.  I think the program file is started from the folder where "Start\Programs\Accessories\System Tools" is located.  Looking at the properties of the shortcut should tell you where it is and it's name.

If it is not installed, the easy way to get it is start IE go to the tools menu and use the update windows option.  Look through the list for "Windows Critical Update Notification" and install it.  Once it is installed you can modify the schedules - adding or taking them out - and you can enable or disable tasks.

Since it is a component of IE I have my doubts you can start it the way you want.  Once you have it installed though you should be able to modify it to do what you want.
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 13760336
Great, thank you! Under Properties, I found:
    C:\WINDOWS\EXPLORER.EXE ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}

On the Internet, I found some info on CreateObject("Scheduler.SchedulingAgent.1"), but that seems to be for the NT environment with a separate scheduling server process.

Let me try some objects, but I expect that VB objects ;)

0
 
LVL 39

Assisted Solution

by:BillDL
BillDL earned 800 total points
ID: 13762209
Task scheduler (mstask.exe) is actually a component of Windows 98 and is installed from "WIN98_46.CAB" (Win98se) along with all the other system utility programs such as magnify.exe, msconfig.exe, msinfo32.exe, mspaint.exe, notepad.exe, etc.  Of course, Internet Explorer is heavily integrated with the Windows Explorer shell, so it's hard to figure whether it's part of IE or part of Windows because it's all wrapped into one in Windows 98.  I would tend to agree with dhsindy that it was something added with the advent of IE's intergration with Win9x.

The 2 files that relate directly to Task Scheduler (mstask.exe and mstask.dll) have both been updated to more recent versions since my original installation of Windows 98SE.  From an inspection of all the .CAB files in a FULL download of IE6 SP1, neither of these files is updated, so it must have been one of my other updates such as a security patch to address something like this:
Microsoft Internet Explorer 'mstask.exe' CPU Consumption Vulnerability
http://www.securityfocus.com/bid/2129/discussion/

If set as a startup program, Task Scheduler runs as a "Machine Service" from:

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
"SchedulingAgent"="c:\windows\SYSTEM\mstask.exe"

The shortcut to "Scheduled tasks" is specified as:

C:\WINDOWS\EXPLORER.EXE ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}

because:

It needs to run in a windows explorer window (explorer.exe) to SHOW YOU the tasks in a non-folder-tree explorer window (ie. a "My Computer" window) which are stored in the folder C:\Windows\TASKS.

The : {20D04FE0-3AEA-1069-A2D8-08002B30309D} is the Class Identifier (CLSID) for My Computer as set in:
HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}

Create a new folder on your desktop and name it:
My Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}
and this will be demonstrated.

The {D6277990-4C6A-11CF-8D87-00AA0060F5BF} refers to the Class Identifier:
HKEY_CLASSES_ROOT\CLSID\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}
which sets the special characteristics for "Scheduled Tasks" (C:\Windows\System\mstask.dll) to display as a special "shell folder" with the correct attributes.

Create a new folder on the desktop and name it:
Scheduled Tasks.{D6277990-4C6A-11CF-8D87-00AA0060F5BF}
to demonstrate this.

The command:

C:\WINDOWS\EXPLORER.EXE ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}

is just telling Windows Explorer to open a new "My Computer" window and display the folder contents of C:\Windows\Tasks with the characteristics set in the registry.

The same effect is achieved using the command line:

C:\WINDOWS\EXPLORER.EXE /n,C:\Windows\TASKS

but there MAY be some attributes specified by that CLSID that Scheduled tasks wants to hide from the Window.  I would have to look carefully at it to see if this is the case.

Try the followng command from the Start menu's "Run" option:

C:\WINDOWS\EXPLORER.EXE ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}

As expected, the {21EC2020-3AEA-1069-A2DD-08002B30309D} makes it open Control panel, because that's the CLSID in the registry for Control Panel.

The only difference between this one and sceduled tasks is that "Control Panel" doesn't exist as a folder like "Tasks".

Basically, the CLSID is required to specify special behaviours, and one of the behaviours of the setting for "Scheduled tasks" is that it the "InProcServer32" is specified in the registry as "c:\windows\system\shell32.dll" for the Control panel, whereas it is specified as "c:\windows\system\mstask.dll" for Task Scheduler.

A .DLL contains resources in the form of dialogs, icons, menu's, bitmaps, cursors, text strings, etc, and the dialogs that you see for each of these examples is determined by the "InProcServer32" registry setting.  In these cases, the Windows folders are being displayed a certain way purposefully, and menu itemsright-click menu's, etc, are affected in the same way that you have a new "Install new Font" menu option when you open the C:\Windows\Fonts folder in Windows Explorer.

So, what this comes down to is whether you want the VB script to OPEN the windows Task Scheduler as a Window to allow a user to perform some action, or whether you need to silently create new, modify existing, remove existing, stop a running, or activate an existing or newly created scheduled task.

Unfortunately this is where my knowledge of Windows programming dwindles out, but hopefully the info I have provided will help your understanding of how Task Scheduler displays.

I would imagine that, if you wanted to specifically call one of the resources within mstask.dll to display a dialog or enable one of the settings, you would have to run a command to it through c:\windows\RunDLL32.exe with the appropriate resource name.

I hope you manage to get an answer here that directly addresses what you wish to achieve, but I do believe that this question would have been better placed in the following Topic Area:

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/

or one of the sub-topics, where all the programmers hang about waiting for such questions :-)

I would have no objection if you asked for this question to be closed so you could have your points refunded so you could ask your question there instead.  I don't know whether dhsindy would raise any objections.

All you would need to do is ask a zero-point question in:
http://www.experts-exchange.com/Community_Support/
quoting the url to THIS question and asking for admin to place a comment here.

Regards
Bill


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Accepted Solution

by:
BillDL earned 800 total points
ID: 13762437
Some apparently useful links:

http://www.codeproject.com/shell/ScheduledTaskWizard.asp

http://www.codecomments.com/archive293-2004-12-353219.html

The references in this document seem to be universal to all Windows versions, but the msdn links seem to refer to NT-based systems.

http://www.onlinetoolworks.com/docs/winTaskSched.doc

Programmatic Control (The Task Scheduler API)
A COM and WMI application programmatic interfaces are available for the Windows Task Scheduler.  Detailed information can be found in the Microsoft Developer Network (MSDN) documentation on how to programmatically control the Task Scheduler.  The COM (Component Object Model) programmatic interface provided requires the ability to program in C++ or one of the .NET languages.  If using .NET, you will need to use COM interop to call any COM API.  The WMI (Windows Management Instrumentation) programmatic interfaces is a better choice for the VB developer.  You can find complete documentation at:

http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_scheduledjob.asp 

and

http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_scheduledjob.asp
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 13762758
My goodness! Thanks a lot you both.

> this is where my knowledge of Windows programming dwindles out

I think I'll place an additional question in the VB area, to attract VB specialists. I chose this section, because they might be distracted into discussing the NT or above Scheduler, which I don't have. I'll up the points to 300, to be able to reward  everybody.
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 13762775
Ah, forgot. The quote "this is where my knowledge of Windows programming dwindles out", I wish I could say the same... ;)
0
 
LVL 39

Expert Comment

by:BillDL
ID: 13763870
Not sure if you are aware of this, but there are several utilities that can be used through the Windows "System Agent".  The basic principle, in applying this to eg. disk cleanup (CLEANMGR.EXE) is as follows:

Start Menu > RUN > and type the following command > click OK

CLEANMGR /d C:\ /sageset:1

Set the configuration options for that utility.  Here the /d switch tells cleanmgr.exe to delete the files as it will now have been configured (I don't think this switch is strictly necessary in Win98), and to act on the C:\ Drive.

This creates a setting that can be a number from 1 to 65,535, and can be recalled using the command:

CLEANMGR  /sagerun:1

The System Agent settings are stored in the key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Plus!\System Agent
but there are only a handful of program files (to my knowledge) that are "System Agent-Aware" in Win98:

CMPAGENT.EXE - Compression Agent (linked with Drivespace3)
CLEANMGR.EXE - as detailed previously
DEFRAG.EXE - Disk Defragmenter
DISKALM.EXE - Low Disk Space notifier (linked with Cmpagent, CleanMgr and Drivespace3)
SCANDSKW.EXE - Windows Scandisk

The SAGERUN number and actions are stored under a sub-key named "Setx" where x is the number chosen with the sageSET process.  I think "Set53" is the default number chosen by Windows.

If you think this is off-topic, then let me explain.  All of these actions can be scheduled via the Windows Task Scheduler by creating a new shortcut somewhere with the COMMAND as your sageRUN command line, and then using Task Scheduler to use that shortcut to run the task.

As I say, I would have no idea how to write a VB Script that would perform something like this and the only reason I have thrown this into the ring is in case it gives you another angle to consider IF you need task scheduler for one of these mundane tasks OR if you can ascertain if the task YOU are tring to do is "System Agent-Aware".

Just thinking out loud here I suppose :-)


0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 13764144
I can really appreciate "loud thinkers" :)  The info you gave is definitely new to me, if I can find some time I'll look into it.

What I was really looking for? It all has to do with a way to activate a Notes client functionality at certain times, without using Busy-wait-agents. I managed to put an activation for the Notes client in, it is set to run every day at 18:00. Upon activation, Notes will show the weekly worksheet application. That's what works.

No I have a different application, I which I would like to manage the activation moments in the database itself. I want an external clock mechanism to fire the Notes client whenever necessary. Just an example: I'd like to send a mail at 12:34 exactly, so I need an action in the Scheduler to activate Notes at 12:34.

;) I don't need the advice to switch to Outl**k or Excharge, nor to create a separate application to do this. The Notes language LotusScript is VB-alike and it has the CreateObject call, so things should be doable from Notes. If only Win98 were a bit more cooperative...
0
 
LVL 39

Expert Comment

by:BillDL
ID: 13766012
On the subject of "an external clock mechanism", I don't suppose you will have seen a tiny utility by a guy named Eric Phelps.

http://www.ericphelps.com/

http://www.ericphelps.com/schedule/index.htm
Written in VB 5 written before Windows had a decent Task Scheduler, but has the benefit that it is a tiny file and doesn't run with an interface - it uses a preset .INI file containing the settings.
http://www.ericphelps.com/schedule/schedule.zip

Notes, which I believe only refer to NT-based systems:

"If you use the AT command, all your tasks run as SYSTEM and can't access the network. If you use the "tasks" GUI to schedule your tasks, you have to enter your username and password for every task -- every time you change your password. So... Use the tasks GUI to run MY schedule program, and let my schedule program start everything else! That way you only have one username/password task to change. If you set the schedule task in the GUI to run on startup, it's as good as being a service".

Other useful pieces of info on the Eric Phelps pages:

http://www.ericphelps.com/scripting/samples/index.htm
(Section Header "Run Other Programs")

http://www.ericphelps.com/scripting/samples/Schedule/index.html
http://www.ericphelps.com/scripting/samples/Schedule/readme.txt

Another very flexible-looking Scheduler:

VisualCron
http://www.visualcron.com/#

VisualCron is windowsbased program that works like the integrated task scheduler but have more features and flexibility. VisualCron is based on the Unix/Linux version of cron.

Features:
http://www.visualcron.com/features.php
Screenshots:
http://www.visualcron.com/screenshots.php
Download:
http://www.visualcron.com/download.php
Win98/ME Issues Resolved:
http://www.visualcron.com/support.php#w98
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 13766372
Help! Whoah! Stop! Drowning :) This is great info, I'll have to delve through this... It would have been nice to do it without additional programs, but, as so often with Windows, that's an illusion. It's a virus system, it gets bigger every release.

Essential requirements:
- scheduler
- can start Lotus Notes client
- has COM interface

PS Read your profile... One of my favourite sites, probably you know it already: http://www.scottish.parliament.uk/home.htm
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 14046078
Following your recommendations...

Thanks both!
0
 
LVL 39

Expert Comment

by:BillDL
ID: 14051007
Thank you, sjef_bosman and LeeTutor
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 14051021
Hi Bill,

I'm sorry I left the question open that long. I hoped someone would give me exactly the code I needed. I still haven't found the right moment to pick this up again. If ever I have the solution, I'll add it here.

Sjef
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
The article covers five tools all IT professionals should know about, as they up productivity by a great deal!
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question