Skip to main content What is Dynamics 365? Guided tours Customer stories Try our products Build your own agents CRM ERP Sales Service Sales Customer Insights Customer Service Contact Center Field Service Supply Chain Management Commerce Finance Project Operations Human Resources Business Central Pricing Business application topics Training & certifications Documentation Migrate to the cloud Private equity Migrate to Dynamics 365 Events Dynamics 365 Blog Product updates Onboarding and implementation Community Find a partner Software Development Companies Partner resources Microsoft Marketplace Product documentation Technical support On-premises product support Contact us Try for free Sign in
1 min read

Checking your MS Dynamics AX users against Active Directory domain resolution


In this blog post I’d like to present the following X++ scipt which you may run as a job if you like. The purpose of this script is to go through all of your users in the MS Dynamics AX security system and check if their SID can be successfully resolved against your Active Directory (AD) domain.
In case there should be an issue you will receive an infolog message which lists the affected users.

Please take the following disclaimer into consideration here:

“Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures.

static void ADDomainResolution(Args _args) 
{ 
  xAxaptaUserManager axUsrMgr; 
  xAxaptaUserDetails axUsrDet; 
  UserInfo userInfo; 
  str userID; 
  str domainName; 
  str userSid; 
  userAccountType accountType;

  axUsrMgr = new xAxaptaUserManager(); 
  while select * from userInfo where userInfo.enable == true 
  { 
    userID = userInfo.networkAlias; 
    domainName = userInfo.networkDomain; 
    accountType = userInfo.accountType; 
    try 
    { 
      axUsrDet = axUsrMgr.getSIDFromName(userID, domainName, accountType); 
    } 
    catch(Exception::Error) 
    { 
      info(domainName + '\\' + userId + ': caused an exception'); 
    } 
  } 
}

Get started with Dynamics 365

Drive more efficiency, reduce costs, and create a hyperconnected business that links people, data, and processes across your organization—enabling every team to quickly adapt and innovate.