Ah, if not ADSI then I would say three choices.
 
1. Chop the DN after the first "DC=", then replace each remaining ",DC="
with ".".  That gives you the DNS Name.
2. Chop the DN to the first DC= and then chase into the partitions container
of the config and pull the nETBIOSName attribute of the appropriate
crossRef object (the one with the nCName equal to the end of the DN you
chopped to earlier.
3. Use DsCrackNames which isn't COM, just DS API. 
 
 joe

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Desmond
Sent: Sunday, August 29, 2004 7:33 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] Determine user's Netbios/DNS Domain Name


Doing this in .net. I can use a COM component if that's the only way. I was
hoping there was an attribute on the user or somewhere up the tree.
 
Thanks,
Brian
 
-----Original Message----- 
From: joe [mailto:[EMAIL PROTECTED] 
Sent: Sun 8/29/2004 4:33 PM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: RE: [ActiveDir] Determine user's Netbios/DNS Domain Name



I think you want IADsNameTranslate Brian assuming you are using ADSI.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/i
adsnametranslate.asp


Richard has a good writeup on it at

http://www.rlmueller.net/NameTranslateFAQ.htm


Basically you convert from ADS_NAME_TYPE_1779 to ADS_NAME_TYPE_NT4 and then
chop off the domain piece.


If you are in batch, take a look at my UserName tool on www.joeware.net
which will return whatever format you want for the current user.


  joe


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Desmond
Sent: Sunday, August 29, 2004 4:09 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] Determine user's Netbios/DNS Domain Name

Is there an attribute that I can look at if I'm bound to a username to find
out the user's domain name?

For example, if I'm bound to myself:

 CN=$Brian Desmond,OU=Tech
Dept,OU=Accounts,DC=payton,DC=cps,DC=k12,DC=il,DC=us

How can I programatically determine one of the two: my netbios domain name
is WPCP or my DNS name is payton.cps.k12.il.us?

Thanks,
Brian
..jjryãv

List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/


<<attachment: winmail.dat>>

Reply via email to