This is a sample job to find the User which exists in Dynamics AX but deleted/Disabled from Active directory.
“Error in getting SID”
static void findUserNames(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));
}
}
}
|