Solved

Interacting with NT Schedule Service

Posted on 1997-08-18
1
277 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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

17 Experts available now in Live!

Get 1:1 Help Now