Get NetBIOS and DNS computer names

Get NetBIOS and DNS computer names


We can get the NetBIOS and DNS computer names of the local computer.

Following is the code

static string GetLocalHostName (int Choice)
{


if (Choice == 1)
{
string netBiosName = System.Environment.MachineName;
return netBiosName;
}
else if(Choice == 2)
{
string dnsName = System.Net.Dns.GetHostByName("LocalHost").HostName;
return dnsName
}
else
{
string dnsName1 = System.Net.Dns.GetHostName();
return dnsName1
}

}


By
Nathan


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: