Click to See Complete Forum and Search --> : Determining User Groups in VBA


PedroD
August 10th, 1999, 09:20 AM
Hi all.
I am currently developing an application in MS Access 97, but I don't want to use Access' security mechanism for validation. Instead, I was hoping to find an API that would allow me to add users to a pre-defined group in NT, and check wether the logged in user belongs to this group or not.. Is there an easy way to do this? I can easily get the username, but there seems to be alot of hassle trying to determine which group he/she belongs to.. HELP!

Lothar Haensler
August 10th, 1999, 09:47 AM
the following script was published in the NT FAQ by John Savill (www.ntfaq.com)
It is based on ADSI. You can download the SDK from the MSSite


on error resume next
strUser="UserID"
set oDomain=GetObject("WinNT://YourDomain")
set oUser=oDomain.Create ("user", strUser)
If (err.number=0) then 'If not 0 then user ID already exists
oUser.SetInfo
oUser.SetPassword "mypassword"
oUser.SetInfo
End If
to update other elements of information you can use
set user=GetObject("WinNT://domain/user") User.FullName=FirstNameVar
User.HomeDirectory=UserHome User.Profile="\\Server\Share\user"
User.LoginScript=LogonScript User.Description="Description"
User.setinfo