The LookupAccountSid function accepts a security identifier (SID) as input. It retrieves the name of the account for this SID and the name of the first domain on which this SID is found.
Nu er det bare sådan at de kun er registreret med deres SID i Navision - den slår op over i AD for at finde navnet. SID ændres ikke for at man evt. retter lidt i efternavnet på en bruger så det vil altid være det samme.
Set usr = GetObject("winmgmts:{impersonationLevel=impersonate}!//comp_name/root/cimv2").ExecQuery("select * from Win32_UserAccount where sid = 's-1-5-21-1454471165-776561741-1801674531-1114'")
For each prop in usr WScript.echo "Name: " & prop.fullname WScript.echo "Domain: " & prop.domain WScript.echo "SID: " & prop.sid Next
My apologies. It is part of WMI (Windows Management Instrumentation). When you state that Navision looks in AD to find the name, then if you want the name you will have to do the same. To test the above code copy and paste in Notepad, change "comp_name" and remove the where clause, then and save with VBS extension. If you have Win2000/XP then you will also have a service WinMgmt.exe running (this is the WMI referred to above) and you just have to double click the file to run it. What you will get is the properties of all local and domain users, including their names and SID's (which is what you want).
Og de bruger faktisk den funktion, jeg gav dig. De har blot en fuld implementation med.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.