Unable to delete an item after adding it directly to the ItemToDelete table. Using a similar query:
insert into ItemToDelete
select guid, GETDATE()
from item where guid = '777f5c01-add9-467e-91c4-b8ba0c671f94' --<Item Guid To Delete>
The following error occurred:
Item attributes (NoDelete) do not include deletion for: 'DESK03_TEST' (777f5c01-add9-467e-91c4-b8ba0c671f94)
Error in the application.
[Altiris.NS.Exceptions.ItemSecurityException @ ]
Exception logged from:
at Altiris.NS.ItemManagement.Item.Delete()
at Altiris.NS.ItemManagement.Item+<>c__DisplayClass395_0.<DeleteItem>b__0(Altiris.Database.IDatabaseContext)
at Altiris.NS.ContextManagement.<>c__DisplayClass31_0<T>.<PerformWithDeadlockRetry>b__0(Altiris.Database.IDatabaseContext)
at Altiris.Database.DatabaseContext<T>.RetryAction(Int32, Boolean, Altiris.Common.Delegates.Getter<Altiris.Database.IDatabaseContext>, System.Action<Altiris.Database.IDatabaseContext>, System.Action<Altiris.Database.DeadlockRetryArgs>, Altiris.Database.DeadlockRetryArgs&, Exception&, Boolean)
at Altiris.Database.DatabaseContext<T>.PerformWithDeadlockRetryHelper(Int32, Boolean, Altiris.Common.Delegates.Getter<Altiris.Database.IDatabaseContext>, System.Action<Altiris.Database.IDatabaseContext>, System.Action<Altiris.Database.DeadlockRetryArgs>, Boolean)
at Altiris.Database.DatabaseContext<T>.PerformWithDeadlockRetry(Int32, Boolean, System.Nullable<System.Data.IsolationLevel>, Boolean, System.Action<Altiris.Database.IDatabaseContext>, System.Action<Altiris.Database.DeadlockRetryArgs>)
at Altiris.NS.ItemManagement.Item.DeleteItem(System.Guid, Altiris.NS.ItemManagement.ItemLoadFlags, Boolean)
at Altiris.NS.ItemManagement.ItemToDeleteSchedule.DeleteItems()
at Altiris.NS.ItemManagement.ItemToDeleteSchedule.OnSchedule(String)
at Altiris.NS.Scheduling.Schedule.Execute(Altiris.Profiling.CodeProfiling.CodeProfiler, System.Guid)
at Altiris.NS.Scheduling.Schedule.Execute(Altiris.NS.Security.SecurityContext, System.Guid)
at Altiris.NS.Security.SecurityContext.ExecuteAsOwner(System.Collections.Generic.ICollection<System.Guid>, System.Guid, System.Action<Altiris.NS.Security.SecurityContext,System.Guid>, Int32, String, String)
at Altiris.NS.Scheduling.Schedule.OnSchedule(String)
at Altiris.NS.Scheduling.ScheduleService.ProcessScheduleImpl(String, Altiris.Profiling.CodeProfiling.CodeProfiler, Altiris.NS.Security.SecurityContext, System.Guid)
at Altiris.NS.Scheduling.ScheduleService+<>c__DisplayClass0_1.<ProcessSchedule>b__0(Altiris.NS.Security.SecurityContext)
at Altiris.NS.Security.SecurityContext+<>c__DisplayClass46_0.<ExecuteAsOwner>b__1(Altiris.NS.Security.SecurityContext)
at Altiris.NS.Security.SecurityContext.ExecuteAs<T,TK>(Altiris.NS.Security.EExecuteAs, TK, System.Func<TK,Altiris.NS.Security.SecurityContext>, System.Func<Altiris.NS.Security.SecurityContext,T>)
at Altiris.NS.Scheduling.ScheduleService.ProcessSchedule(String)
at Altiris.NS.Scheduling.ScheduleService.ProcessScheduleWithCleanup(String, Boolean)
at Altiris.Diagnostics.RemoteControl.ScheduleServiceProxy.ProcessScheduleImpl(String, Boolean)
at Altiris.Diagnostics.RemoteControl.ScheduleServiceProxy.ProcessScheduleThreadProc(Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object)
at Altiris.Diagnostics.RemoteControl.ScheduleServiceProxy.ProcessSchedule(String, Boolean)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr, Object[], Object, Object[]&)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
at System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
at System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessageCallback(Object[])
at System.Runtime.Remoting.Channels.ChannelServices.DispatchMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack, System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage&)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack, System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Channels.ITransportHeaders, System.IO.Stream, System.Runtime.Remoting.Messaging.IMessage&, System.Runtime.Remoting.Channels.ITransportHeaders&, System.IO.Stream&)
at System.Runtime.Remoting.Channels.SoapServerFormatterSink.ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack, System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Channels.ITransportHeaders, System.IO.Stream, System.Runtime.Remoting.Messaging.IMessage&, System.Runtime.Remoting.Channels.ITransportHeaders&, System.IO.Stream&)
at System.Runtime.Remoting.MetadataServices.SdlChannelSink.ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack, System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Channels.ITransportHeaders, System.IO.Stream, System.Runtime.Remoting.Messaging.IMessage&, System.Runtime.Remoting.Channels.ITransportHeaders&, System.IO.Stream&)
at System.Runtime.Remoting.Channels.Tcp.TcpServerTransportSink.ServiceRequest(Object)
at System.Runtime.Remoting.Channels.SocketHandler.ProcessRequestNow()
at System.Runtime.Remoting.Channels.SocketHandler.BeginReadMessageCallback(IAsyncResult)
at System.Net.LazyAsyncResult.Complete(IntPtr)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object)
at System.Net.ContextAwareResult.Complete(IntPtr)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object, IntPtr)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
-----------------------------------------------------------------------------------------------------
Date: 6/23/2020 3:38:37 PM, Tick Count: 1857999468 (21.12:06:39.4680000), Size: 6.63 KB
Process: AeXSvc (33944), Thread ID: 87, Module: Altiris.NS.dll
Priority: 1, Source: Item.Delete
ITMS 8.0 and later
The actual attribute for this item was set to "16", which means "NoDelete".
1. Check what is the actual Item Attribute for this Item:
select Guid, Name, Attributes from Item
where GUID = '<Item Guid To Delete>'
2. It is most likely that is set to '16'. You will need to update the Attribute to '0', which means "Normal" and it should let you delete the item:
Update Item
set Attributes = 0
where Guid = '<Item Guid To Delete>'
3. Check if the item is still in the ItemToDelete table:
select * ItemToDelete
where guid = '<Item Guid To Delete>'
If not, add it back again:
insert into ItemToDelete
select guid, GETDATE()
from item where guid = '<Item Guid To Delete>'
3. Run NS.Quarter Hour schedule (under Task Scheduler on your SMP server), the item will be removed from the database.