Forum Discussion

fazlook's avatar
fazlook
Frequent Contributor
9 years ago

How do I get the domain type using TC ?

Let's say my domain is TC.com or TC.ca, how do I get the ca or com part ?   SYS.domainname gives me only the name.   Thank you  
  • HKosova's avatar
    HKosova
    9 years ago

    cunderw wrote:

    It sounds like you want the the domain name of your computer? SYS.domainname is for the currently loggen in user which isn't always the name of the domain. You wnat the system domain name.

     

    Try this:

     

    dotNET.System_DirectoryServices_ActiveDirectory.Domain.GetComputerDomain().ToString();

     

    You will have to add the System.DirectoryServices component to your CLR bridge to access this.


    Here's another way, without using .NET:

    ' VBScript
    CreateObject("ADSystemInfo").DomainDNSName
    
    // JScript
    (new ActiveXObject("ADSystemInfo")).DomainDNSName