Sunday, 3 May 2015

“Error in getting SID” when running Named user license count report [AX 2012]

Recently I tried running the Named user license count report and got this error.

“Error in getting SID”

From the error I know what the problem is. One of the users can not be found in Active directory.

I wrote a quick job to find me the invalid users.

static void navax_findBadUserNames(Args _args)
{
UserInfo userInfo;
container con;
;   while select forUpdate userInfo
where userInfo.Enable &&
userInfo.AccountType != UserAccountType::ADGroup
{
con = SysUserLicenseMiner::getUserRoles([userInfo.Id, userInfo.company]);
if (conLen(con) == 0)
{
warning(strFmt("Userid: %1, username: %2", UserInfo.networkAlias, UserInfo.name));
}
}
}

You will get something like this in the infolog.


image

3 comments:

Anonymous said...

This job doesn't work in AX 20120 RTM CU3. Eror getUserRoles is not a class method. How do I solve this issue?
Best regards
Johan

Munib Ahmed said...

Hi Johan,
You would have to look at the code in later version to see what that method does.
I haven't spend anytime to investigate further.

Anonymous said...

Munib, thank you for this X++ code! It was a very easy solution to a problem that I didn't know where to start.

After apply CU10 in AX 2012 R3 to update from CU8, a new error appeared in the Windows event log with ID 110 License miner job run failed. I tried running the Named user license count report in a job and it failed. Your code helped me identify the invalid users, and upon removing them the errors stopped.

Command to refresh the report:
{
SysUserLicenseMiner::GenerateUserLicenseCountReportInfo();
}

Cheers, and thanks again!

-Ryan