Solved

Interacting with NT Schedule Service

Posted on 1997-08-18
1
278 Views
Last Modified: 2010-04-06
I am writing an application to interact with the NT Schedule service but I have not been able to find any documentation or references to this. Specifically I want to know how to get a list of currently scheduled jobs, how to add a job and how to delete a job. These functions are available at command line but I need to have my application talk directly to the service. Presumeably there are API calls to handle this. Any assistance or guidance would be appreciated. Also please use "newbiespeak" in any response. :-)

Kurt
0
Comment
Question by:kurt11
1 Comment
 
LVL 3

Accepted Solution

by:
mirek071497 earned 100 total points
ID: 1341797
Schedule service functions are :
  - job submittal (NetScheduleJobAdd),
  - job cancellation (NetScheduleJobDel),
  - job enumeration (NetScheduleJobEnum),
  - retrieving information about a particular job (NetScheduleJobGetInfo).
In order for these functions to succeed, a caller must have administrator's
privilege at a computer where Schedule service is running.

This functions is in Win32.hlp but without structures.


Data Structures

AT_INFO data structure is used by NetScheduleJobAdd( ) to specify
a job to be added, and by NetScheduleJobGetInfo( ) to return
information about an already submitted job.

AT_ENUM data structure is used by NetScheduleJobEnum( ) to enumerate
and return information about an entire queue of already submitted jobs.


typedef struct _AT_INFO {
      DWORD      JobTime;
      DWORD      DaysOfMonth;
      UCHAR      DaysOfWeek;
      UCHAR      Flags;
      LPWSTR      Command;
} AT_INFO, *PAT_INFO, *LPAT_INFO;

typedef struct _AT_ENUM {
      DWORD      JobId;
      DWORD      JobTime;
      DWORD      DaysOfMonth;
      UCHAR      DaysOfWeek;
      UCHAR      Flags;
      LPWSTR      Command;
} AT_ENUM, *PAT_ENUM, *LPAT_ENUM;

JobId      -Job identifier of an already submitted job.
JobTime    -Time of day when a job is scheduled to run.
            Time is a local time at a computer where Schedule service
            is running. Time is measured from midnight
            and is expressed in milliseconds.
DaysOfMonth-Bitmask for days of month when a job is scheduled
            to run. The bitmask is NULL if a job was scheduled
            to run only once at the first occurrence of JobTime.
            For each bit that is set in the bitmask a job
            will run at JobTime on a corresponding day of the month.
            Bit 0 corresponds to first day of the month, etc.
DaysOfWeek -Bitmask for days of week when this job is scheduled to run.
            The bitmask is NULL if a job was scheduled to run only once
            at the first occurrence of JobTime.
            For each bit that is set in the bitmask a job will run
            at JobTime on a corresponding day of the week.
            Bit 0 corresponds to Monday (first day of the week), etc.
Flags      -Bitmask describing job properties.
            For job submission (NetScheduleJobAdd) possible values are:
            JOB_RUN_PERIODICALLY
              If this flag bit is set then job runs on every day
              where corresponding bits in DaysOfMonth or DaysOfWeek
              are set. If this flag bit is clear then job runs
              only once for each bit that was set in DaysOfMonth
              and/or DaysOfWeek at the time of job submission.
            JOB_ADD_CURRENT_DATE
              When this flag bit is set then job will also execute
              at the first occurrence of JobTime at the computer
              where job is submitted to. In other words,
              setting this flag bit is equivalent to setting
              the corresponding day bit in DaysOfMonth bitmask.

            For job information retrieval
              (NetScheduleJobEnum and NetScheduleJobGetInfo) possible
              values are:
              JOB_RUN_PERIODICALLY
                This flag bit is equal to the original value
                of this flag bit when a job was submitted.
              JOB_EXEC_ERROR
                This flag bit is set whenever Schedule service
                failed to execute successfully this job
                the last time this job was supposed to run.
              JOB_RUNS_TODAY
                This flag bit is set if JobId is larger
                than the current time of day at the computer
                where this job is queued at.
Command     -Points to a Unicode string that contains the name
             of command, batch program or binary file to execute.


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now