--------------------------------------------------------------------------------
Resolution
Complete the following:
To remove an orphaned object from the Notification Server tree use the following script:
nscript.exe deleteanitem.cs
and this will delete the object associated with this GUID. Always validate the GUID before removing it. This can be done by the following steps:
a. Open SQL Query Analyzer.
b. Make sure that you select the correct database, i.e. Altiris.
c. Type the following: select * from vitem where guid like '
If it does not show, then go ahead and complete step 1.
Note: The nscript.exe file is found on the Notification Server in ...\program files\altiris\notification server\bin. The deleteanitem.cs file must be created and the blue part at the end of this article must be pasted in that file.
(Optional) If the script in step 1 does not remove the NS tree object, then there is likely an association that needs to be removed. This can be done with the following script:
delete from ItemReference where hint = 'policyappliestocollection' and ParentItemGuid =
this is DeleteAnItem.cs (Copy and paste the code)
using System;
using System.IO;
using Altiris.NS.ItemManagement;
using Altiris.NS.Security;
class MyScriptClass
{
static void Main( string[] args )
{
//
// Set the context for the current user
//
SecurityContextManager.SetContextData();
Guid itemGuid = Guid.Empty;
try
{
itemGuid = new Guid( args[ 0 ] );
}
catch( FormatException )
{
throw new ApplicationException( "Must pass a GUID as an argument" );
}
//
// Get the collection item
//
IItem itemToExport = Item.GetItem( itemGuid ) ;
if( null == itemToExport )
throw new ApplicationException( "The GUID does not match an item" );
itemToExport.Delete();
//
// Export the item
//
}
}
No comments:
Post a Comment