Configuration Manager Current Branch: How to collect information from the Task Scheduler

Duchemin, Dominique 2,006 Reputation points
2023-04-20T23:50:09.2233333+00:00

Hello, I have the need to collect the information from the Task Scheduler for several purposes:

  1. to verify all task have the same parameters date/time... for a specific task
  2. to verify the task exist or not I saw several posts on this: https://learn.microsoft.com/en-us/answers/questions/175515/sccm-to-query-task-scheduler https://social.technet.microsoft.com/Forums/en-US/f6914e9b-94e9-4efe-8a0c-34e5b1d93347/inventory-of-scheduled-tasks?forum=configmgrgeneral I copied the article Syntax from this article https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-scheduledjob in a new xxxx - Win32_ScheduleJob.mof file now I will try to import it ... Thanks, Dom
Microsoft Configuration Manager
{count} votes

6 answers

Sort by: Most helpful
  1. Duchemin, Dominique 2,006 Reputation points
    2023-04-21T00:18:57.3333333+00:00

    Hello, I am getting an error... checking the CIM_Job? e:\SCCM\inboxes\clifiles.src\hinv>mofcomp "xxxx - Win32_ScheduleJob.mof" Microsoft (R) MOF Compiler Version 10.0.14393.0 Copyright (c) Microsoft Corp. 1997-2006. All rights reserved. Parsing MOF file: xxxx - Win32_ScheduleJob.mof MOF file has been successfully parsed Storing data in the repository... An error occurred while creating object 1 defined on lines 8 - 29: Error Number: 0x8004101c, Facility: WMI Description: Propagated property Compiler returned error 0x8004101c Checking!! Thanks, Dom


  2. Duchemin, Dominique 2,006 Reputation points
    2023-04-21T03:26:15.5066667+00:00

    Hello, I tried the mofcomp with the same file but only: string   Caption; and I have also the error ... I copy/paste the content from the Microsof article and did the mofcomp... Any clue? Thanks, Dom

    0 comments No comments

  3. AllenLiu-MSFT 43,061 Reputation points Microsoft Vendor
    2023-04-21T06:39:29.9566667+00:00

    Hi, @Duchemin, Dominique

    Thank you for posting in Microsoft Q&A forum.

    Have we tried to compile the .mof file from the link:

    https://social.technet.microsoft.com/Forums/en-US/f6914e9b-94e9-4efe-8a0c-34e5b1d93347/inventory-of-scheduled-tasks?forum=configmgrgeneral


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".

    0 comments No comments

  4. Duchemin, Dominique 2,006 Reputation points
    2023-04-21T07:08:21.7033333+00:00

    Hello, Yes with this content I have another erro: :\SCCM\inboxes\clifiles.src\hinv>mofcomp "xxxx - Win32_ScheduleJob.mof" Microsoft (R) MOF Compiler Version 10.0.14393.0 Copyright (c) Microsoft Corp. 1997-2006. All rights reserved. Parsing MOF file: xxxx - Win32_ScheduleJob.mof MOF file has been successfully parsed Storing data in the repository... An error occurred while creating object 1 defined on lines 13 - 53: 0X80041002 Class, instance, or property 'SMS_Class_Template' was not found. Compiler returned error 0x80041002

    #pragma namespace("\\\\.\\ROOT\\CIMV2") 
    
    
    //**************************************************************************
    //* Class: Win32_ScheduleJob
    //**************************************************************************
    
    
    [ SMS_Report     (TRUE),
      SMS_Group_Name ("Scheduled Job"),
      SMS_Class_ID   ("CUSTOM|SCHEDULED_JOB|1.0") ]
    
    class Win32_ScheduledJob : SMS_Class_Template
    {
        [SMS_Report (FALSE)     ]
            string     Caption;
        [SMS_Report (TRUE)     ]
            string     Command;
        [SMS_Report (TRUE)     ]
            uint32     DaysOfMonth;
        [SMS_Report (TRUE)     ]
            uint32     DaysOfWeek;
        [SMS_Report (FALSE)     ]
            string     Description;
        [SMS_Report (FALSE)      ]
            datetime ElapsedTime;
        [SMS_Report (FALSE)      ]
            datetime InstallDate;
        [SMS_Report (TRUE)     ]
            boolean    InteractWithDesktop;
        [SMS_Report (TRUE), key ]
            uint32     JobId;
        [SMS_Report (TRUE)      ]
            string     JobStatus;
        [SMS_Report (FALSE)     ]
            string     Name;
        [SMS_Report (FALSE)     ]
            string     Notify;
        [SMS_Report (FALSE)     ]
            string   Owner;
        [SMS_Report (FALSE)     ]
            uint32     Priority;
        [SMS_Report (TRUE)      ]
            boolean    RunRepeatedly;
        [SMS_Report (TRUE)      ]
            datetime StartTime;
        [SMS_Report (FALSE)      ]
            string     Status;
        [SMS_Report (FALSE)      ]
            datetime TimeSubmitted;
        [SMS_Report (FALSE)      ]
            datetime UntilTime;
    };
    

    Thanks, Dom

    0 comments No comments

  5. Duchemin, Dominique 2,006 Reputation points
    2023-04-21T07:16:00.22+00:00

    Hello @AllenLiu-MSFT yes I have another error with this one

    #pragma namespace("\\\\.\\ROOT\\CIMV2") 
    
    
    //**************************************************************************
    //* Class: Win32_ScheduleJob
    //**************************************************************************
    
    
    [ SMS_Report     (TRUE),
      SMS_Group_Name ("Scheduled Job"),
      SMS_Class_ID   ("CUSTOM|SCHEDULED_JOB|1.0") ]
    
    class Win32_ScheduledJob : SMS_Class_Template
    {
        [SMS_Report (FALSE)     ]
            string     Caption;
        [SMS_Report (TRUE)     ]
            string     Command;
        [SMS_Report (TRUE)     ]
            uint32     DaysOfMonth;
        [SMS_Report (TRUE)     ]
            uint32     DaysOfWeek;
        [SMS_Report (FALSE)     ]
            string     Description;
        [SMS_Report (FALSE)      ]
            datetime ElapsedTime;
        [SMS_Report (FALSE)      ]
            datetime InstallDate;
        [SMS_Report (TRUE)     ]
            boolean    InteractWithDesktop;
        [SMS_Report (TRUE), key ]
            uint32     JobId;
        [SMS_Report (TRUE)      ]
            string     JobStatus;
        [SMS_Report (FALSE)     ]
            string     Name;
        [SMS_Report (FALSE)     ]
            string     Notify;
        [SMS_Report (FALSE)     ]
            string   Owner;
        [SMS_Report (FALSE)     ]
            uint32     Priority;
        [SMS_Report (TRUE)      ]
            boolean    RunRepeatedly;
        [SMS_Report (TRUE)      ]
            datetime StartTime;
        [SMS_Report (FALSE)      ]
            string     Status;
        [SMS_Report (FALSE)      ]
            datetime TimeSubmitted;
        [SMS_Report (FALSE)      ]
            datetime UntilTime;
    };
    

    ============================================== e:\SCCM\inboxes\clifiles.src\hinv>mofcomp "xxxx - Win32_ScheduleJob.mof" Microsoft (R) MOF Compiler Version 10.0.14393.0 Copyright (c) Microsoft Corp. 1997-2006. All rights reserved. Parsing MOF file: xxxx - Win32_ScheduleJob.mof MOF file has been successfully parsed Storing data in the repository... An error occurred while creating object 1 defined on lines 13 - 53: 0X80041002 Class, instance, or property 'SMS_Class_Template' was not found. Compiler returned error 0x80041002 Any idea? Thanks,
    Dom

    0 comments No comments