Solved

Return FQDN of machine

Posted on 2006-07-17
5
1,600 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now