Issue updating User Record for a Name Change
We have automated the CRUD of users for our CRM On-premises Environemtn by triggering Powershell scripts from our automation App. It all works well but we are on occasion getting errors when we are going through Name Changes.
It all seems to connect up fine as expected but reports the following error which i am unable to debug the cause:
Exception error executing PowerShell script: System.Management.Automation.RuntimeException: LookupAccountNameW failed with error ---> System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: LookupAccountNameW failed with errorServer stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request) at Microsoft.Xrm.Tooling.Connector.CrmServiceClient.CrmCommand_Execute(OrganizationRequest req, String errorStringCheck) --- End of inner exception stack trace --- at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input) at JvrPsEngine.cmJvrPsEngineThreadData.ExecuteScript(Runspace pRunSpace, cJvrXmlDocument pSrcXml)
If i run through the powershell itself I don't get any errors, albeit at a later time. if you can offer any suggestions on what is causing the error I would be grateful.
@tycho13 are you creating AD during that process and there is really short time between creation of the user in AD and adding it in CRM? Which format do use for login UPN ([email protected]) or domain-like (domain\user)?
Hi @sergeytunnik
We are performing a name change on the existing user Account. We don't have a sync between the AD and CRM accounts, hence why our Provisiong tool has to run the script to update the CRM account for the user.
We are using Domain\Username so "Contoso\hsimpson" for example.
Never performed account rename in CRM. But as workaround I can recommend using UPN style. We used it to avoid similar issues with LookupAccountNameW during provisioning new users both in AD and CRM. AFAIK CRM just doesn't check if that user really present in AD when UPN is used thus no error. But still then user is able to successfully login into IFD enabled CRM deployment. Not sure if logging in worked fine with domain-like format. Unfortunately right now I don't have on-premise environment to check.
Yep @sergeytunnik is on to what I think the issue is as well, LookupAccountNameW (https://msdn.microsoft.com/en-us/library/windows/desktop/aa379159%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396) is a windows function to find the users name.
If the DC that CRM happens to be bound to at that point in time is offline or not responding to requests then this lookup may fail (if you have verbose or info level CRM Tracing on you'd see if in there as well). You could try setting the preferredDC reg string value in the MSCRM reg key location (which isn't recommended, but would pin your requests to a single DC for that period of time).
Again, I don't recommend this but if you used it temporarily for your process that may work. The issue with setting this is, if your DC you're pointing at goes down then it will fail and not attempt to find a new DC on the next lookup. Your best bet would be to retry after a failure like this to see if it works.
https://support.microsoft.com/en-us/help/954811/microsoft-dynamics-crm-4-0-deployment-manager-takes-a-long-time-to-ope
I have spoken with our CRM Admins who confirmed there is an LDAP Lookup done when accounts are amended so it's looking like this is a timing issue as we have multiple DC's.
Thanks for the help.