![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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. http://www.rlmueller.net/NameTranslateFAQ.htm -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |