Solved

Return FQDN of machine

Posted on 2006-07-17
5
1,608 Views
Last Modified: 2012-06-27
Hi all,

I am hoping to return the FQDN of the computer running this win app.

Environment.MachineName just doesn't cut it :)

Anyone got a solution?

Bryan
0
Comment
Question by:bryanford
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 41

Expert Comment

by:graye
ID: 17131991
Hummm.... so what were you expecting as an answer?

Something like:   CN=MACHINE12,CN=Workstations,DN=SomeDomain,DN=Com

or just:        Machine12.SomeDomain.Com

I'd recommend an LDAP query against the domain to get either answer
0
 
LVL 1

Author Comment

by:bryanford
ID: 17134696
I dont think an LDAP query would do the job because of what happens. This app will be run on a few different machines on different forests and i dont want to hard code any domain settings anywhere.

I am just after something like Machine12.somedomain.com

The environment.machinename only gives you Machine12
0
 
LVL 41

Assisted Solution

by:graye
graye earned 200 total points
ID: 17137768
If you're using VB.Net 2005, then you can use the new IPGlobalProperties class

Imports System.Net.NetworkInformation
Debug.writeline(IPGlobalProperties.GetIPGlobalProperties.HostName & "." & IPGlobalProperties.GetIPGlobalProperties.DomainName)
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 300 total points
ID: 17140416
Try this:

   Dim fqdn As String = System.Net.Dns.GetHostByName("LocalHost").HostName

Bob
0
 
LVL 1

Author Comment

by:bryanford
ID: 17142325
Thanks guys,

Both return what I am after however the shortest code wins the majority of points :)

Thanks for that

Bryan
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question