Hi everybody,
for automatically creating user logins in several NAV 2009 CC databases I need the SID for the user, which I get from table 2000000050 "Windows Object". But this takes one or two minutes per user due to our large and possibly faulty Active Directory. Is there a faster way to get the SID for a user that has no login in Navision?
I don't mind connecting to Active Directory Services or whatever is needed, as I'm already reading the AD Groups of the user.
Thank you!
0
Comments
Did you checked the function SID?
Maybe you can execute "cmd /C wmic useraccount where (name=''%1'' and domain =''%2'') get sid", save the result in a temporary text file and parse it to get your SID? You can also save all SIDs and load them in NAV?
Have a look at this function:
MS SQL Server has a function SUSER_SID, that retrieves the SID in binary format. I stole
sqlservercentral.com/scripts/SID/62274/
to convert this to the string SID Navision uses. The code looks like this:
In fact there is a lot more easier solution. If you want to simplify your code or for any other forum menber looking for a solution
There is a virtual table that converts SID to ID and ID to SID: https://msdn.microsoft.com/en-us/library/dd355232.aspx
In my tests, it displays all domain users (no matter if if the user is created on the database or not).
it should be
This does not work on my machine.
This works fine for me.
The code I suggested is used in standard Codeunit 418 function ValidateUserID (NAV 2009 of course).
Anyway, the goal is to get it work
The best way to approach it is to create buffer table with the same fields, add all necessary keys, declare it as an in-memory variable, and populate in a straight loop at the beginning of your code.
Something like this:
Then down the line pick up required values from the in-memory table.
The Windows Objects is not visible in Object Designer but can be used in the code, or as a source table in a form or a report.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
I would mark this thread a solved, but I haven't found a way to do that...