Discussion:
Canonical Name
(too old to reply)
Mick Reynolds
2005-09-26 10:41:04 UTC
Permalink
is it possible to have script to return the canonical name of the computer
object of the computer that the end user is currently logged onto. e.g. if
the end user computer name is PC1 and the ADS object is in
computers.company.com it returns the value PC1 company.com/computer/pc1 (i.e.
the computer name and the canonical name)

Thanks
Peter Lundin
2005-09-26 17:56:05 UTC
Permalink
--
Set oADsSysInfo = CreateObject("ADSystemInfo")
oADObjDN = oADsSysInfo.ComputerName

Set oComputer = GetObject ("LDAP://" & oADObjDN)

oComputer.GetInfoEx Array("canonicalName"), 0
sComputerCanonicalName = oComputer.Get("canonicalName")

Wscript.Echo sComputerCanonicalName
--

Or you could build the canonical name from the DN directly w/o querying th AD.
Post by Mick Reynolds
is it possible to have script to return the canonical name of the computer
object of the computer that the end user is currently logged onto. e.g. if
the end user computer name is PC1 and the ADS object is in
computers.company.com it returns the value PC1 company.com/computer/pc1 (i.e.
the computer name and the canonical name)
Thanks
Mick Reynolds
2005-09-28 12:09:03 UTC
Permalink
Thanks Peter

It works fine!

Mick
Post by Peter Lundin
--
Set oADsSysInfo = CreateObject("ADSystemInfo")
oADObjDN = oADsSysInfo.ComputerName
Set oComputer = GetObject ("LDAP://" & oADObjDN)
oComputer.GetInfoEx Array("canonicalName"), 0
sComputerCanonicalName = oComputer.Get("canonicalName")
Wscript.Echo sComputerCanonicalName
--
Or you could build the canonical name from the DN directly w/o querying th AD.
Post by Mick Reynolds
is it possible to have script to return the canonical name of the computer
object of the computer that the end user is currently logged onto. e.g. if
the end user computer name is PC1 and the ADS object is in
computers.company.com it returns the value PC1 company.com/computer/pc1 (i.e.
the computer name and the canonical name)
Thanks
Loading...