Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Fully Qualified Domain Name (FQDN) From Just Domain?

Status
Not open for further replies.

SalemGrafix

IS-IT--Management
Jun 12, 2003
46
0
0
US
I have the domain name populating in a list box. What I need to do is not only the domain name, but also populate the full name. (ie. Not just tek-tips, but tek-tips and the .com part as well).

This is for LAN access only, this is not something I'm looking to use on the internet (not sure if that's important or not).

Code:
    Dim objNameSpace
    Dim Domain
    
    Set objNameSpace = GetObject("WinNT:")
    For Each objdomain In objNameSpace
        List1.AddItem objdomain.Name & " | " & objdomain.Class
    Next

This populates a listbox with the domains on our LAN, and also that they are a domain (I believe it should represent workgroup if it's a workgroup, but we don't have any on our LAN to test that with).

Any help with this is greatly appreciated.
 
why not just add & ".com" to the end of your List1.additem statement? This would add the .com for you. Are you asking to do a DNS Query to figure out what the actual domain name is?

LF
 
We have multiple domains on our network, and most are actually ".net" although, not all of them are. Also, this would pose a problem later down the road if I made a static list of the domains available.

I actually need the fully qualified domain name entry so that I can then connect to LDAP to get a list of the users. This code has already been worked out, I just want the end-user to be able to select which domain from a list that is pulled live from the network.

I don't necessarily have to use the GetObject("WinNT:") method for doing this, if it can be done using LDAP, even better.
 
I would imagine that you would want to do a DNS query. I think if you concentrated on the IP addresses of the network computers rather than the partial domain name that you are getting now, then perhaps you can do some sort of reverse DNS query and get the FQDN from that. How to? well, that is where I fall short. The IP thing I could do, it's the DNS query stuff that I know nothing about. Anyway, I hope this helps to maybe put a different perspective on this for you.

LF
 
Actually, now that I think about it. Do you have a WINS server setup on your net? If so, then I don't think you would need the FQDN to connect to any of the computers because WINS would know which computer name goes with which IP address. Just an additional thought...

LF
 
I found some code here that will get the computer names from the domain--I think this is what you want to do. It doesn't list the ".com" part, but as I said earlier, I don't think you would need that. It seems that even if you didn't have a WINS server, then whenever a person attempted to connect to "computerA" then I would think that a DNS query would automatically happen, via TCP/IP, and route the user to the necessary computer. I could be wrong...


Hope this helps...

LF
 
Unfortunately, neither would be the case in this instance. Because I'm connecting to the servers using LDAP, I do need the FQDN, I have tried to connect leaving off the "extension" for each, and no go.

As for WinS, we are running that, but I have no idea how to resolve the FQDN from that using VB, if all I know is the domain name.

The program I already have created connecting using LDAP works fine to get the list of computers and users, and the OU's that they are in, so long as I hard-code (or even ask for user input of) the domain name and "extension". What I'm trying to do, is make it as user-friendly as possible, by having the program pull the entire domain list down, and have it user selectable from a combo box.

Thanks for trying to help, it is greatly appreciated, and I do believe that you are on the right track with the DNS Lookup, but I have no clue as to how I go about getting that information. I will continue to search around in the meantime, and see if I can find some code that relates to that.

Again, thank you for trying, and hopefully it does point me in the right direction. Thanks. :)
 
Hey, no problem...

I am not familiar with LDAP so I don't know how it works. If it were possible, and I were you, then I would look into using Winsock. With Winsock, you don't need the FQDN in order to initiate a connection; all you need is the computername and the port number you wish to connect to. Anyhow... Sorry I couldn't be of more help. The good news is that my post will bump your subject up to the top once again! :) Good Luck in your venture...

LF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top