Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - NameTranslate help.

Reply
 
Old 08-20-2009   #1 (permalink)
3ng1n33r


 
 

NameTranslate help.

Hello scripting gurus.

I need your help.

I am working on a script which I need to query the domain name, I have got
that part working.

Set objRootDSE = GetObject("LDAP://RootDSE")
strDomain = objRootDSE.Get("DefaultNamingContext")

My problem comes, that the value it returns is in the Distinguished name
format "DC=domain,DC=root" and I need it in the form of "domain.root"

I understand that NameTranslate can be used to do this and store it on a
variable, but either I'm being thick or it's beyond my capacity, I haven't
managed to get it to work.

I would appreciate your help with this, if there is a better way of doing
this in a vbscript please let me know.

Thanks.

My System SpecsSystem Spec
Old 08-20-2009   #2 (permalink)
3ng1n33r


 
 

RE: NameTranslate help.

Well after more research I found what i need.

This two lines of code get me the result I want.

Set objADSysInfo = CreateObject("ADSystemInfo")
WScript.Echo objADSysInfo.DomainDNSName

Thanks everyone!

"3ng1n33r" wrote:
Quote:

> Hello scripting gurus.
>
> I need your help.
>
> I am working on a script which I need to query the domain name, I have got
> that part working.
>
> Set objRootDSE = GetObject("LDAP://RootDSE")
> strDomain = objRootDSE.Get("DefaultNamingContext")
>
> My problem comes, that the value it returns is in the Distinguished name
> format "DC=domain,DC=root" and I need it in the form of "domain.root"
>
> I understand that NameTranslate can be used to do this and store it on a
> variable, but either I'm being thick or it's beyond my capacity, I haven't
> managed to get it to work.
>
> I would appreciate your help with this, if there is a better way of doing
> this in a vbscript please let me know.
>
> Thanks.
My System SpecsSystem Spec
Old 08-20-2009   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: NameTranslate help.


"3ng1n33r" <3ng1n33r@xxxxxx> wrote in message
news:EC4F7563-5C54-4648-B84F-63B69C886C5B@xxxxxx
Quote:

> Hello scripting gurus.
>
> I need your help.
>
> I am working on a script which I need to query the domain name, I have got
> that part working.
>
> Set objRootDSE = GetObject("LDAP://RootDSE")
> strDomain = objRootDSE.Get("DefaultNamingContext")
>
> My problem comes, that the value it returns is in the Distinguished name
> format "DC=domain,DC=root" and I need it in the form of "domain.root"
>
> I understand that NameTranslate can be used to do this and store it on a
> variable, but either I'm being thick or it's beyond my capacity, I haven't
> managed to get it to work.
>
> I would appreciate your help with this, if there is a better way of doing
> this in a vbscript please let me know.
>
> Thanks.
This link shows how to use the NameTranslate object in VBScript:

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

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 08-20-2009   #4 (permalink)
3ng1n33r


 
 

Re: NameTranslate help.

Hi Richard,

Thanks for your reply.

The truth is I've been there at the NameTranlsate FAQ site, before I came
here for help, to be honest I couldn't work it out how to use it. I
understand it's a powerful tool which I may come back and use it in the
future. But now I've found a solution which is simpler and more pratical for
what I need. Therefore I shouldn't complicate it.

Thanks again.

"Richard Mueller [MVP]" wrote:
Quote:

>
> "3ng1n33r" <3ng1n33r@xxxxxx> wrote in message
> news:EC4F7563-5C54-4648-B84F-63B69C886C5B@xxxxxx
Quote:

> > Hello scripting gurus.
> >
> > I need your help.
> >
> > I am working on a script which I need to query the domain name, I have got
> > that part working.
> >
> > Set objRootDSE = GetObject("LDAP://RootDSE")
> > strDomain = objRootDSE.Get("DefaultNamingContext")
> >
> > My problem comes, that the value it returns is in the Distinguished name
> > format "DC=domain,DC=root" and I need it in the form of "domain.root"
> >
> > I understand that NameTranslate can be used to do this and store it on a
> > variable, but either I'm being thick or it's beyond my capacity, I haven't
> > managed to get it to work.
> >
> > I would appreciate your help with this, if there is a better way of doing
> > this in a vbscript please let me know.
> >
> > Thanks.
>
> This link shows how to use the NameTranslate object in VBScript:
>
> http://www.rlmueller.net/NameTranslateFAQ.htm
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46