Error when you Attempt to Delete a Package using the XenApp Connector for Configuration Manager 2007 R2

The following issue may occur when you are using the XenApp Connector for Configuration Manager 2007. When you click to delete a package under the System Center Configuration Manager node – Site Database – Computer Management – Software Distribution – XenApp Publications, you get the following error:

ConfigMgr cannot delete the specified object. Please verify that you have delete access to the selected object and refresh the ConfigMgr Administrator console to verify that another administrator has not moved or deleted the object.

This error occurs in spite of the permissions being correct. In addition, the SmsAdminUI.log will show the following error:

  [3][8/31/2011 1:21:04 PM] :Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryException\r\nFailure deleting management object\r\n at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Delete(ReportProgress progressReport)

   at Microsoft.ConfigurationManagement.AdminConsole.ConsoleView.ConsoleFormView.DeleteResultItems(Object sender, ActionDescription actionDescription, Status status, IResultObject selectedResultObject, PropertyDataUpdated dataUpdatedDelegate)\r\nConfigMgr Error Object:

instance of SMS_ExtendedStatus

{

      CauseInfo = "4";

      Description = "CSspPkgProgram: Unknown offer error!";

      ErrorCode = 2152205061;

      File = "c:\\qfe\\nts_sms_fre\\sms\\siteserver\\sdk_provider\\smsprov\\ssppkgprogram.cpp";

      Line = 541;

      Operation = "DeleteInstance";

      ParameterInfo = "SMS_Program.PackageID=\"SBT00153\",ProgramName=\"Microsoft Office Professional 2007\"";

      ProviderName = "WinMgmt";

      StatusCode = 2147749889;

This can happen if the assets related to this XenApp package are deleted but the database record has not been deleted. These packages are stored in the same manner as other packages and advertisements. You can connect to the SQL Configuration Manager database and  run a SQL statement to delete these records. You will need to know the Advertisement and Package ID’s.  You can find this information out for sure by running a SQL Profiler trace while reproducing the issue as shown in the following profiler trace output:

 

Once you know what needs to be removed, you will need to run the SQL scripts to remove the entries. If you only need to worry about the package, we can simply ignore the advertisement steps and use the package steps.

To remove the stale advertisements, run the following SQL statement:

Select * from programoffers where offerid = 'advertismentID'

Delete from programoffers where offerid = 'advertismentID'

 - where advertisementID refers to the ID you found in the above trace.

To remove the stale packages, run the following SQL statement:

Select * from smspackages where pkgid = 'PackageID'

Delete from smspackages where pkgid = 'PackageID'

 - where PackageID refers to the ID you found in the above trace.

Once these are deleted, additional SQL triggers will remove the other remaining references and entries related to these records in other tables.