0

I have a service application running on an application server. As part of that, I need to be able to identify the "full computer name" or UNC name of the server running the service.

So for example, I could use :

My.Computer.Name

Or

System.Environment.MachineName

But both of these just return the NETBIOS name i.e. ABCD1234

I want the fully qualified name recognisable across the network, i.e. ABCD1234.mydomain.mysubdomain.com

How can I achieve this easily in VB.NET, it seems like such a simple thing to retrieve but I can't find a method anywhere?

Thanks

Al

Alan O'Brien
  • 151
  • 1
  • 13
  • 2
    https://stackoverflow.com/questions/804700/how-to-find-fqdn-of-local-machine-in-c-net – MatSnow Sep 09 '20 at 14:46
  • I had not found the question above, but the code is the same for VB. My answer was, System.Security.Principal.WindowsIdentity.GetCurrent().Name should give domain\user, if that helps? Another way is Environment.UserDomainName. For the actual machine name, this works for me: System.Net.Dns.GetHostName – Jimmy Smith Sep 09 '20 at 14:49
  • 1
    Thanks @MatSnow that was precisely what I was looking for - had googled every name and acronym for fully qualified paths under the sun apart from FQDN... – Alan O'Brien Sep 11 '20 at 07:30

0 Answers0