VB Code:
'In form
lngWin32apiResultCode = NetScheduleJobEnum("", udtAtInfo, MAX_PREFERRED_LENGTH, lOutEntriesRead, lOutTotal, 0)
'In module
Declare Function NetScheduleJobAdd Lib "netapi32.dll" (ByVal Servername As String, Buffer As Any, JobId As Long) As Long
Declare Function NetScheduleJobEnum Lib "netapi32.dll" (ByVal Servername As String, Buffer As Any, PreferredMaximumLength As Long, EntriesRead As Long, TotalEntries As Long, ResumeHandle As Long) As Long
' Schedule structure
Type AT_INFO
JobId As Long
JobTime As Long
DaysOfMonth As Long
DaysOfWeek As Byte
Flags As Byte
dummy As Integer
Command As String
End Type
' Schedule constants
Public Const JOB_RUN_PERIODICALLY = &H1
Public Const JOB_NONINTERACTIVE = &H10
Public Const NERR_Success = 0
Public Const MAX_PREFERRED_LENGTH As Long = -1