Page 1 of 1 1
Topic Options
#111760 - 2004-01-13 09:04 PM AD binding practices
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I have seen a number of posts where the contents of AD (accounts, groups, and OUs) are dumped and stored in a database for one reason or another. I myself do this to provide access to this data for reporting purposes as well as some other applications where we automatically enable and disable accounts via an Oracle based security application which moves disabled accounts to and from a secure OU.

When storing records about the previous state of an account that made be needed in the future for further processing, I only store the GUID of the account, the GUID of the parent OU from which the account was moved, the userAccountControl value, and any other point in time data that is pertinent. Not only is this data more compact than store the distinguished of the account and OU, it provide the only truly safe way of finding the same object at a future date. If your OU tree get modified through renaming an OU or pruning and grafting your stored DNs are worthless. If accounts get renamed then even relying on the TranslateNAme UDF is not much help.

But if you stored the GUID you are just fine. You can bind directly to the GUID of an object using the LDAP provider.

The guid of an object can be obtained via $object.Guid when you first dumped or had the object originally. You can use the following code to bind directly to the specific object you desire regardless of where it now exists in the hierarchy or by whatever name it is now known.

Code:

$Guid = 'a1ab60d1c2724e409005db95ac64048e'
$oUser = GetObject("LDAP://DomainName/<GUID=$Guid>")
$NewDN = $oUser.distinguishedName



_________________________
Home page: http://www.kixhelp.com/hb/

Top
#111761 - 2004-01-14 12:33 AM Re: AD binding practices
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Thanks, Howard. That's good stuff.
Top
#111762 - 2004-01-14 01:12 AM Re: AD binding practices
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
You mean, GUID stuff ?
Top
#111763 - 2004-01-14 01:13 AM Re: AD binding practices
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Oh, you're punny.
Top
#111764 - 2004-01-14 01:19 AM Re: AD binding practices
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
No he is PUNY
Top
#111765 - 2004-01-14 04:56 PM Re: AD binding practices
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Howard, had the chance to test your code today. I found that adding the domain name was unneccesary...

Code:

$oADUser = GetObject("LDAP://<GUID="+$oUser.GUID+">")
@ERROR " " @SERROR ?

$oADUser.distinguishedName ?


Top
#111766 - 2004-01-14 04:58 PM Re: AD binding practices
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
More information: Using objectGUID to Bind to an Object
Top
#111767 - 2004-01-16 07:26 PM Re: AD binding practices
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The domain or server is only optional if the GUID you want to bind to is in the same domain as your client. I have found that when binding to a GUID from another domain (in the same forest) some value is needed or the binding fails.

[edit]
This seems to be the case when using an NT4 account binding to the AD. When logged on with an AD account this does appear to be truly optional.


Edited by Howard Bullock (2004-01-16 07:30 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 871 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.052 seconds in which 0.034 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org