How can I convert a computer's NT 4 name to distinguished name?

How can I convert a computer's NT 4 name to distinguished name?

Post by Snow Wan » Thu, 07 Jun 2001 01:03:53



Hi,

    Does DsCrackName() work with computer as well? I want to translate a
given NT 4 computer name to Active Directory distinguished name, but it
doesn't seem to work. Any advice? Thanks.

Snow

 
 
 

1. Converting a computer name from NT Name to ADSI Name

Hi all,

First, thanks to Wayne Tilton for his vb Code in a previous mail.
I used his code to convert user names from NT4 to ADSI, and it's ok.
I'm now trying to make the same thing with computer names and it doesn't
work. Error : Name not found

Do you know why ?

Thanks
Bruno

My code :

   Option Explicit
   Dim Domain, NTDomain, nto, AdObj, AdsPath

   Const ADS_NAME_TYPE_1779 = 1
   Const ADS_NAME_TYPE_NT4 = 3
   Const ADS_NAME_INITTYPE_GC = 3

   ' Get name to be translated (wo/NT domain)
   AdObj = "MyComputer"

   ' Get the LDAP default naming context so we can bind to the GC
   Domain = GetObject("LDAP://RootDSE").Get("DefaultNamingContext")

   ' Get the NT style Domain name for the NT4 lookup
   NTDomain = GetObject("LDAP://" & Domain).dc

   ' Create name translate object and connect to GC for translations
   Set nto = CreateObject("NameTranslate")
   nto.Init ADS_NAME_INITTYPE_GC, Domain

   ' Set nto w/NT style domain\user
   nto.Set ADS_NAME_TYPE_NT4, NTDomain & "\" & AdObj

   ' Get RFC1779 (LDAP) name translation
   AdsPath = nto.Get(ADS_NAME_TYPE_1779)

2. Alife and AI

3. Getting distinguished name of a computer object (not the local computer)

4. BUG in arpa/inet.h

5. converting from an NT name to an ADSI name

6. Jornada and Targus Stowaway Keyboard

7. how to determine distinguished name from sAMAccountName (or pre-win2k name)

8. Dual Processing on Win98

9. Print jobs; are owner's name same as login user's name?

10. Domain Name 2 Computer Name script

11. Samba using computer name instead of login name

12. Computer name = User name?

13. Names, and names, and names, Oh, My...