Items are missing from the NS Console after Package Replication import

Article:TECH13172  |  Created: 2006-03-27  |  Updated: 2006-03-27  |  Article URL
Article Type
Technical Solution


Items are missing from the NS Console after Package Replication import.  A search for the items in the Item table shows that they still exist in the database and are still available and working for Software Delivery, but the console does not display them because they are no longer listed in the ItemReference or ItemFolder tables as child items of a parent folder.

This problem starting occurring after the upgrade to NS 6.0 SP3.


NS 6.0 SP3 (upgraded from SP2)


In NS 6.0 SP3, when a folder item is imported without an ItemReferences included in the XML, all current ChildItemGuid references where hint='folderchilditem' are deleted from the ItemReference table during the import process.  All items display in the NS console via the parent-child relationship described by the ItemFolder table and that table is updated daily as part of the NS.Daily Scheduled Task and intermittently during certain item loads.  Once the ItemReference has been deleted for an item, it is only a matter of time before the ItemFolder table is updated and the item will no longer display under any folder in the console.

Package Replication on the Parent NS exports all folder items without ItemReferences included in the XML by design and Parent Replication on the child NS does not necessarily import parent folder items before child folder items.  When a folder is imported as part of the Child NS Package Replication process, which will occur if the ModifiedDate on that folder item from the Parent NS is more recent than the the last Child NS import date, all existing folder child items for that folder are deleted from the ItemReference table during the folder import.


The NS Dev team is currently reviewing the code to determine the appropriate solution.  As a work-arounds, there are some steps which can identify and correct the display issue on the Child NS after the Package Replication process has run.  Note: The parent NS must be established as a 'Linked Server' via MS SQL for the child NS in order for this process to work correctly.  Please see the SQL documentation for the steps to accomplish that.

Report on Replicated Items which no longer have a folder reference
Run the following query in SQL Query Analyzer:

/*** Begin Query ***/
USE Altiris

SELECT i.Name, t.Type, r.ItemGuid
FROM ItemReplLastModified r,
Item i,
vLocalizedItemType t
WHERE r.ItemGuid = i.Guid
AND i.ClassGuid = t.ClassGuid
AND t.Culture = 'en-US'
AND r.ItemGuid NOT IN
 (SELECT ChildItemGuid FROM ItemReference WHERE Hint = 'folderchilditem')
ORDER BY t.Type, i.Name
/*** End Query ***/

Correct Replicated Items which no longer have a folder reference*
This is a two step process:

1. Execute the SQL command below in SQL Query Analyzer on the Child NS to update the ItemReference table with appropriate data from the Parent NS.  Please replace the <ParentNS> in the query with the name of the Parent Notification Server before you run it:

/***Begin Command***/
USE Altiris

INSERT INTO [ItemReference]([ParentItemGuid], [ChildItemGuid], [Hint], [ReferenceType], [CreatedDate], [ModifiedDate])
SELECT p.ParentItemGuid, r.ItemGuid, 'folderchilditem', 1, GETDATE(), GETDATE()
FROM ItemReplLastModified r,
(SELECT * FROM OPENQUERY (<ParentNS>, 'SELECT ChildItemGuid, ParentItemGuid FROM Altiris.dbo.ItemReference WHERE Hint = ''folderchilditem''')) p
WHERE r.ItemGuid = p.ChildItemGuid
AND r.ItemGuid NOT IN (SELECT ChildItemGuid FROM ItemReference WHERE Hint = 'folderchilditem')
/*** End Command***/

2. Open Scheduled Tasks control panel on the Child NS and run the NS.Daily schedule to update ItemFolder table and then refresh the NS Console if it is already open in IE to see the items immediately.

*NOTE: You may see items returned from this Report query but not modified by the Update command if Package Replication failed to appropriately delete an item on the Child NS which was deleted from the Parent NS.  To validate this, check whether the ItemGuids returned for the Report query on the Child NS appear in the ItemGuids in the ItemDeleted table on the Parent NS - SELECT * FROM ItemDeleted WHERE ItemGuid IN ('guid1', 'guid2', 'etc').

Legacy ID


Article URL

Terms of use for this information are found in Legal Notices