Failed to import package into software library. Could not impersonate user.
search cancel

Failed to import package into software library. Could not impersonate user.

book

Article ID: 267414

calendar_today

Updated On:

Products

IT Management Suite Software Management Solution

Issue/Introduction

While trying to "validate" the current Software Library path (Software Library Configuration under Settings>All Settings>Software>Software Catalog and Software Library Settings),

the customer got these errors:

Entry 1:

An unexpected error occurred during path validating. Could not impersonate user "example\OldAccount". Current user is "example\CurrentAccount".
-----------------------------------------------------------------------------------------------------
Date: 6/5/2023 12:17:14 PM, Tick Count: 262229734 (3.00:50:29.7340000),  Size: 392 B
Process: w3wp (1096), Thread ID: 268, Module: Altiris.SoftwareManagement.Web.dll
Priority: 1, Source: PackageRepositoryConfig.ValidateUNC
Failed to import package into software library: \\exampledir\Software Library\a368c2ff-7904-410c-83bf-3cd78e85b5f9

Entry 2:

Could not impersonate user "example\OldAccount". Current user is "example\CurrentAccount".
   [ImpersonationException @ Altiris.NS.dll]
   at Altiris.NS.Utilities.Impersonate.ImpersonateUser(string, string, string, bool)
   at Altiris.SoftwareManagement.Utilities.Impersonate.AsAgentConnectivity()
   at Altiris.SoftwareManagement.PackageRepository.PackageRepositoryManager.EnsurePackageDirectory(string, out bool)
   at Altiris.SoftwareManagement.PackageRepository.PackageRepositoryManager.ConvertToManagedPackage(string)

Could not impersonate user "example\OldAccount". Current user is "example\CurrentAccount".
   [SecurityException @ Altiris.Profiling.dll]
   at Altiris.Profiling.Support.ImpersonateOps.ImpersonateUser(string, string, SecureString, bool)
   at Altiris.NS.Utilities.Impersonate.ImpersonateUser(string, string, string, bool)

Could not logon as user "example\OldAccount". Current user is "example\CurrentAccount". Token=0, LastError=1326 (The user name or password is incorrect).
   [SecurityException @ Altiris.Profiling.dll]
   at Altiris.Profiling.Support.ImpersonateOps.CreateUserLogonToken(string, string, SecureString, int, int, out IntPtr)
   at Altiris.Profiling.Support.ImpersonateOps.ImpersonateUser(string, string, SecureString, bool)

The user name or password is incorrect
   [Win32Exception]

Exception logged from:
   at Altiris.Diagnostics.Logging.EventLog.ReportException(int, string, string, Exception, string)
   at Altiris.SoftwareManagement.PackageRepository.PackageRepositoryManager.ConvertToManagedPackage(string)
   at Altiris.SoftwareManagement.PackageRepository.PackageRepositoryManager.ConvertToManagedPackage()
   at Altiris.SoftwareManagement.Web.Dialogs.dlgUpgradePackage.UpgradePackage(Guid)
   at Altiris.SoftwareManagement.Web.Dialogs.dlgUpgradePackage.Page_Load(object, EventArgs)
   at System.Web.UI.Control.OnLoad(EventArgs)
   at Altiris.NS.UI.Controls.PageCachePage.OnLoad(EventArgs)
   at Altiris.SoftwareManagement.UI.SoftwarePageBase.OnLoad(EventArgs)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(bool, bool)
   at System.Web.UI.Page.ProcessRequest(bool, bool)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext)
   at Altiris.NS.UI.Controls.PageCachePage.ProcessRequest(HttpContext)
   at Altiris.NS.UI.AltirisPage.ProcessRequest(HttpContext)
   at ComponentArt.Web.UI.CallbackHandler.ProcessRequest(HttpContext)
   at System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep, ref bool)
   at System.Web.HttpApplication+PipelineStepManager.ResumeSteps(Exception)
   at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext, AsyncCallback)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest, HttpContext)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, int)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, int)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, ref RequestNotificationStatus)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, ref RequestNotificationStatus)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, int)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, int)

User [example\CurrentAccount], AppDomain [/LM/W3SVC/1/ROOT/Altiris/SoftwareManagement-5-133304584512698860]

HTTP [POST]: https://smpserver.example.net/Altiris/SoftwareManagement/Dialogs/dlgUpgradePackage.aspx?itemguid=a368c2ff-7904-410c-83bf-3cd78e85b5f9
 ip: [xxxxxxxxx]; languages: [en-US]; content-length: [829];
 timings: [[R] 00:00:00.1574805(W: 00:00:00.0156256)];
 response: [200 OK]; x-smp-nsversion: [8.7.1273.0];
-----------------------------------------------------------------------------------------------------
Date: 6/5/2023 12:13:25 PM, Tick Count: 262000078 (3.00:46:40.0780000),  Size: 4.30 KB
Process: w3wp (1096), Thread ID: 146, Module: Altiris.NS.dll
Priority: 1, Source: Impersonate.ImpersonateUser

 

You may see a similar error as well when trying to edit a package (verifying the current package path) under Manage>All Resources>Package:

WebApi Controller failure.

Could not impersonate user "example\OldAccount". Current user is "example\CurrentAccount".
   [ImpersonationException @ Altiris.NS.dll]
   at Altiris.NS.Utilities.Impersonate.ImpersonateUser(string, string, string, bool)
   at Altiris.SoftwareManagement.Utilities.Impersonate.AsAgentConnectivity()
   at Altiris.SoftwareManagement.SoftwareManagementHelper.ValidateDirectoryExt(string)
   at Altiris.SoftwareManagement.WebApi.Controllers.UtilsController.ValidateDirectory(string)
   at Altiris.SoftwareManagement.WebApi.Controllers.UtilsController.ValidateLocalPath(string)
   at .lambda_method(Closure, object, object[])
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor+ActionExecutor+<>c__DisplayClass6_2.<GetExecutor>b__2(object, object[])
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext, IDictionary<string,object>, CancellationToken)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker+<InvokeActionAsyncCore>d__1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task)
   at System.Web.Http.Controllers.ActionFilterResult+<ExecuteAsync>d__5.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task)
   at System.Web.Http.Controllers.ExceptionFilterResult+<ExecuteAsync>d__6.MoveNext()

Could not impersonate user "example\OldAccount". Current user is "example\CurrentAccount".
   [SecurityException @ Altiris.Profiling.dll]
   at Altiris.Profiling.Support.ImpersonateOps.ImpersonateUser(string, string, SecureString, bool)
   at Altiris.NS.Utilities.Impersonate.ImpersonateUser(string, string, string, bool)

Could not logon as user "example\OldAccount". Current user is "example\CurrentAccount". Token=0, LastError=1326 (The user name or password is incorrect).
   [SecurityException @ Altiris.Profiling.dll]
   at Altiris.Profiling.Support.ImpersonateOps.CreateUserLogonToken(string, string, SecureString, int, int, out IntPtr)
   at Altiris.Profiling.Support.ImpersonateOps.ImpersonateUser(string, string, SecureString, bool)

The user name or password is incorrect
   [Win32Exception]

Exception logged from:
   at Altiris.Diagnostics.Logging.EventLog.ReportException(int, string, string, Exception, string)
   at Altiris.SoftwareManagement.WebApi.ApiControllerExceptionHandlerAttribute.OnException(HttpActionExecutedContext)
   at System.Web.Http.Filters.ExceptionFilterAttribute.OnExceptionAsync(HttpActionExecutedContext, CancellationToken)
   at System.Web.Http.Filters.ExceptionFilterAttribute+<ExecuteExceptionFilterAsyncCore>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<TStateMachine>(ref TStateMachine)
   at System.Web.Http.Filters.ExceptionFilterAttribute.ExecuteExceptionFilterAsyncCore(HttpActionExecutedContext, CancellationToken)
   at System.Web.Http.Filters.ExceptionFilterAttribute.System.Web.Http.Filters.IExceptionFilter.ExecuteExceptionFilterAsync(HttpActionExecutedContext, CancellationToken)
   at System.Web.Http.Controllers.ExceptionFilterResult+<ExecuteAsync>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder<>.Start<TStateMachine>(ref TStateMachine)
   at System.Web.Http.Controllers.ExceptionFilterResult.ExecuteAsync(CancellationToken)
   at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext, CancellationToken)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher+<SendAsync>d__15.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder<>.Start<TStateMachine>(ref TStateMachine)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage, CancellationToken)
   at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage, CancellationToken)
   at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage, CancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage, CancellationToken)
   at Altiris.SoftwareManagement.WebApi.ApiControllerAntiForgeryHandler.SendAsync(HttpRequestMessage, CancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage, CancellationToken)
   at System.Web.Http.HttpServer+<SendAsync>d__24.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder<>.Start<TStateMachine>(ref TStateMachine)
   at System.Web.Http.HttpServer.SendAsync(HttpRequestMessage, CancellationToken)
   at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage, CancellationToken)
   at System.Web.Http.WebHost.HttpControllerHandler+<ProcessRequestAsyncCore>d__12.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<TStateMachine>(ref TStateMachine)
   at System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore(HttpContextBase)
   at System.Web.TaskAsyncHelper.BeginTask(Func<Task>, AsyncCallback, object)
   at System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep, ref bool)
   at System.Web.HttpApplication+PipelineStepManager.ResumeSteps(Exception)
   at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext, AsyncCallback)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest, HttpContext)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, int)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, int)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, ref RequestNotificationStatus)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, ref RequestNotificationStatus)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, int)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, int)

User [example\OldAccount], AppDomain [/LM/W3SVC/1/ROOT/Altiris/SoftwareManagement/Api-6-133304584582814215]

HTTP [GET]: https://smpserver.example.net/altiris/softwaremanagement/api/validate/localpath?path=d:%5Caltiris%5Cpatch management%5Cpackages%5Cwindows agent%5Cwin64
 ip: [xxxxxxxxxx]; languages: [en-US];
 timings: [[R] 00:00:00.0468698(W: 00:00:00)];
 response: [200 OK]; x-smp-nsversion: [8.7.1273.0];
-----------------------------------------------------------------------------------------------------
Date: 6/5/2023 12:09:36 PM, Tick Count: 261771843 (3.00:42:51.8430000), Size: 6.90 KB
Process: w3wp (1096), Thread ID: 150, Module: Altiris.NS.dll
Priority: 1, Source: Impersonate.ImpersonateUser

Environment

ITMS 8.6, 8.7

Cause

The issue was caused by an invalid account associated with the "Distribution Point Credential"

Resolution

If you are not using the default AppID account for your "Distribution Point Credential", please make the proper change (adding a valid account) here:

1. Go to Settings>Notification Server Settings>Distribution Point Credential