Domain Mamber netbios name

Hello, could somebody please explain to me in a simple Way how I can find my netbois name

I have a Windows Server with a Server 2003 and a local domain. I bought myself a WD My Book now and I want to connect it to my network and instead running it under workgroup I would like to run it under the domain.

Thank you very much in advance for your help.

This first approach may be too simplistic, but you should be able to tell the domain name by going into SYSTEM PROPERTIES via MyComputer or Network properties.

Else, here is a method I found on line at

http://geekswithblogs.net/Tariq/archive/2009/07/30/133813.aspx

Find the NetBios Name of a domain in AD

Its been quite a bit of struggle for me to find an accurate way of finding the netbios name of a domain from AD using System.DirectoryServices.

In case you are in the same jam here how you do it.

  1. Connect to AD using the following ldap url: LDAP://CN=Partitions,CN=Configuration,DC=,DC=<local|com>
  2. When querying AD using the Directory Searcher object uses the following filter: netbiosname=*

This should give you a record from AD containing the netbios name of the domain as the CN

Explanation

AD stores the the netbios name in the Partitions naming container which is stored inside the configuration naming container.

A more detailed explanation and more samples can be found in the Active Directory Cookbook or its online version

Code sample:

// Method call

string netBiosName = GetNetBiosName( LDAP://CN=Partitions,CN=Configuration,DC=,DC=<local|com>,  “<userName”", “”);

// Method call

// Method Definition

private string GetNetBiosName(
    string ldapUrl,
    string userName,
    string password)
{
    string netbiosName = string.Empty;
    DirectoryEntry dirEntry = new DirectoryEntry(ldapUrl,
            userName, password);

    DirectorySearcher searcher = new DirectorySearcher(dirEntry);
    searcher.Filter = “netbiosname=*”;
    searcher.PropertiesToLoad.Add(“cn”);

    SearchResultCollection results = searcher.FindAll();
    if (results.Count > 0)
    {
        ResultPropertyValueCollection rpvc = results[0].Properties[“CN”];
        netbiosName = rpvc[0].ToString();
    }
    return netbiosName;
}

Crossposted from tariqayad.com