Error: "Object reference not set to an instance of an object" when opening properties of Scheduled Tasks

Version 8

    Verified Product Versions

    Endpoint Manager 9.5

    Issue

     

    The following error can occur when opening the properties of a Scheduled Task in the Console:

     

    Object reference not set to an instance of an object.

    System.NullReferenceException: Object reference not set to an instance of an object.
      at LANDesk.ManagementSuite.SoftwareDistribution.WinUI.TaskScheduler.ScheduledTaskFolder.SummaryPanel.InitScopeTextbox()
      at LANDesk.ManagementSuite.SoftwareDistribution.WinUI.TaskScheduler.ScheduledTaskFolder.SummaryPanel.OnLoad()
      at LANDesk.ManagementSuite.PanelObjectInterface.PanelObject.DoLoad(PanelManager panelManager)
      at LANDesk.ManagementSuite.ldPropertySheet.ldPropertySheetCtrl.loadPanelObject(String classPath, Assembly currentAssembly)
      at LANDesk.ManagementSuite.ldPropertySheet.ldPropertySheetCtrl.ParseXML(IEnumerable psList, TreeNode parent, Assembly currentAssembly, String assemblyName, Hashtable hshTab)
      at LANDesk.ManagementSuite.ldPropertySheet.ldPropertySheetCtrl.LoadXMLFile(String sourceFile)
      at LANDesk.ManagementSuite.ldPropertySheet.ldPropertySheetDialog.LoadXMLFile(String file)
      at LANDesk.ManagementSuite.SoftwareDistribution.WinUI.TaskScheduler.ScheduledTaskPanelManager..ctor(TaskNode taskNode, String xmlFileName, String connectionString)
      at LANDesk.ManagementSuite.SoftwareDistribution.WinUI.TaskScheduler.TaskNode.OnProperties()

     

     

    Cause

     

    When deleting a user from the RBA and choosing the option to transfer all exisiting objects to another user, there can be problem with the transferred Scheduled Tasks, most often in the case of started Policy Delivery tasks. In the database the dbo.LD_TASK ScopeUser_Idn is NOT updated with the ConsoleUser_Idn of the new owner of the task. This results in the above error message when opening the properties of the task.

     

    If you open the SQL Management Studio and connect to the LANDesk Database you can run the following SQL query to doublecheck.

     

    select * from dbo.LD_TASK where ScopeUser_Idn not in (select ConsoleUser_Idn from dbo.ConsoleUser) And ScopeUser_Idn <> '0'

     

     

    This will show all tasks where the ScopeUser_Idn doesn't exist anymore in the actual User Table. ScopeUser_Idn 0 seems to be valid for tasks like scheduled reports and such.

     

    Resolution

     

    If the results of this statement correspond with the tasks that generate an error when opening the properties, look up the ConsoleUser_IDN of the user you want to be owner of these tasks in the dbo.ConsoleUser table.

     

    After that, run the following SQL query, replacing X with the ConsoleUser_Idn found above:

     

    update dbo.LD_TASK SET ScopeUser_Idn=X where ScopeUser_Idn not in (select ConsoleUser_Idn from dbo.ConsoleUser) And ScopeUser_Idn <> '0'