Get NetBIOS and DNS computer names


SUBMITTED BY: Guest

DATE: Dec. 7, 2013, 4:12 p.m.

FORMAT: C#

SIZE: 411 Bytes

HITS: 55175

  1. Get NetBIOS and DNS computer names
  2. using System;
  3. static string GetLocalHostName ()
  4. {
  5. string netBiosName = System.Environment.MachineName;
  6. //return netBiosName;
  7. // Following method is deprecated
  8. // string dnsName =
  9. // System.Net.Dns.GetHostByName("LocalHost").HostName;
  10. string dnsName = System.Net.Dns.GetHostName();
  11. return dnsName;
  12. }

comments powered by Disqus