Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Jul : IADSUser and SetInfo

www.cryer.info
Managed Newsgroup Archive

IADSUser and SetInfo

Subject:IADSUser and SetInfo
Posted by:"John Scott" (john_s..@hotmail.com)
Date:Mon, 25 Jul 2005 17:59:41 +0100

Im having a few problems accessing my works Active Directory from
Delphi.  Some brief history:  We had a NT based domain for years, and I
have written my own 'user manager' which allowed me to carry out my
Desktop support duties.  We are now moving to Active Directory and I
found that my old code for the NT domain sort of worked for the AD.  I
had read access, but it would never set changes to user accounts.  Now I
have decided to move from the 'NetQueryDisplayInformation' and
'NetUserGetInfo' to ADSI based code.

With ADSI I can read user information, but once again changes dont get
sent to the AD and I get "General Access Denied" errors when calling
SetInfo() for the IADSUser object.  Im assuming that its some sort of
privilege problem, I know that in the AD im not a "Domain Admin",
although I do have basically the same permissions; I can manage accounts
and Add/Delete PCs from the AD.  Also the AD Users and Computers MMC
lets me reset passwords and manage user accounts..

Anyway heres some code after that long essay..


ADsGetObject('WinNT://MYDOMAIN/USERTOEDIT', IADsUser, usr);
Assert(usr <> nil);
// snipped some code which loads the user obj into a form and lets the
user edit it..

//sample code to set the "User cannot change password" property
Usr.Put('userFlags', Usr.Get('UserFlags') or ADS_UF_PASSWD_CANT_CHANGE)
usr.SetInfo(); // <-- causes General ACcess Denied error.

Has anyone got any suggestions?  Thanks in advance.

Info

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive