Solved

Return FQDN of machine

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

10 Experts available now in Live!

Get 1:1 Help Now