Kicking off Schedule Task for 'Windows Patch Remediation Settings' - Unknown exception was thrown
search cancel

Kicking off Schedule Task for 'Windows Patch Remediation Settings' - Unknown exception was thrown

book

Article ID: 157211

calendar_today

Updated On:

Products

Patch Management Solution for Windows Patch Management Solution IT Management Suite

Issue/Introduction

While running 'Import Patch Data for Windows' using the 'Delete' and 'Incremental' options, PMImport fails with an 'Unknown exception was thrown' on the screen. 

The NS logs only show the error listed below:

Module: AtrsHost.exe
Source: PMC:PMResourceImportTask.OnExecuteSingleton
Description: Unable to cast object of type 'Altiris.SoftwareManagement.Resources.SoftwareUpdateResource' to type 'Altiris.PatchManagementCore.Resources.PatchSoftwareUpdateResource'.
[System.InvalidCastException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]
   at Altiris.PatchManagementCore.Tasks.Server.PMResourceImportTask.RemoveSWUpdatesBasedOnExcludedSWReleases()
   at Altiris.PatchManagementCore.Tasks.Server.PMResourceImportTask.ExecuteTask(IServerTaskExecutionInstance instance)
   at Altiris.PatchManagementCore.Tasks.Server.PMResourceImportTask.OnExecuteSingleton(IServerTaskExecutionInstance i)

 

Environment

ITMS 8.x
Patch Management Solution 8.x

Cause

Wrong associations were created in the database for some Patch Resources

Resolution

Work through the following troubleshooting steps:

  1. Run the following script in SQL to view corrupt associations:

     select i.Name, c.Type, i.*
     from vItem i
     join Class c on c.Guid = i.ClassGuid
     where c.Type like '%SoftwareUpdateResource%'
     order by 2,1

This will display items associated to 'Altiris.PatchManagementCore.Resources.PatchSoftwareUpdateResource' and 'Altiris.SoftwareManagement.Resources.SoftwareUpdateResource'
Note: The items that are associated to 'Altiris.SoftwareManagement.Resources.SoftwareUpdateResource' will need to be deleted

CAUTION: Found one case where items returned for the bad '...SoftwareUpdateResource' were not specific to Patch Management, for there was corrupt Software Management Jobs that were hanging the process as it executed to update those associations. Worked through the following and it resolved the issue, but the individual Software Management Jobs had to be cleaned up separately, and some of them had to be deleted from the 'ItemResource' table in the database directly due to associations failing to clear.

Work through the following to delete the bad  '...SoftwareUpdateResource' associations:

  1. Create a custom SQL Report:
    • Go to the Console > Reports > All Reports.
    • Highlight the Parent Folder 'Reports' and right-click > Report > New SQL Report.
    • Input the following SQL Script on the Parameterized Query tab: 

           select i.Guid as _ItemGuid, i.Name, c.Type, i.*
           from vItem i
           join Class c on c.Guid = i.ClassGuid
           where c.Type like '%SoftwareUpdateResource%'
           and Type ='Altiris.SoftwareManagement.Resources.SoftwareUpdateResource'
           order by 2,1

       
  2. Run the Custom SQL Report; Highlight the results, right-click > Delete to clear the bad associations.
     
  3. Run the PMImport on schedule or 'Now' without the following settings enabled for clean download:
    • ​​​Incremental import​
    • Delete previously downloaded data for vendors, software and languages that are now excluded 
    • Automatically revise Software Update policies after importing patch data
    • Enable distribution of newly added Software Updates
    • Disable all superseded Software Updates
       
  4. Once the PMImport is downloaded without errors; enable the desired settings disabled in Step #3 for future PMImport management.