Link to home
Start Free TrialLog in
Avatar of SAM2009
SAM2009Flag for Canada

asked on

Is there a cmd which can send directly a query to the host to obtain his domain?

Is there a cmd which can send directly a query to the host to obtain his domain?  I don't want a query to DNS (suppose it's not configured properly ). Which cmd can give the domain of the host if I have his ip adr? I have list of 100 servers to verify...
ASKER CERTIFIED SOLUTION
Avatar of OrenRozen
OrenRozen
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of -HenryM-
-HenryM-

i am unaware of a single command...

however you could execute a script to accomplish this...

http://www.codeproject.com/KB/vbscript/userinfo.aspx
SOLUTION
Avatar of Steve Tempest
Steve Tempest
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

There is no definitive answer to the question you would be asking.

For example, I could point both:

www.example.com

AND

www.invalid.com

to the same IP address (say, 123.123.123.123)

If so, then what is the correct answer to your question?

This is very common with multiple websites being hosted on a single server, especially at the 'cheap' (or free) end of the market.

Alan.
Avatar of SAM2009

ASKER

Alan what you said is correct if the domain is queried by the DNS that why I asked for for something which query the info directly to the host machine if I have the IP.
Hi,

Please look at my initial post to your question.
It uses the SYSTEMINFO command line. using this command following the IP address of the remote machine you get additional including the domain as shown on that remote machine.
and the script just filters all the other information to show the result that is the domain.

Maybe I didn't understand your question question   and if so, I'd appreciate if you'll clarify.

Thanks,
Oren
Avatar of SAM2009

ASKER

Ya I tried. I put the cmd in "get_dom.bat" and run the cmd like this but the only thing I get is the cmd back:

C:\>get_dom.bat 192.168.1.1

C:\>for /F "tokens=2" %a in ('systeminfo /S 192.168.1.1 | find /i "Domain:"') DO echo %a
from command line try :

systeinfo /S 192.168.1.1

you should get a lot of information. one of the fields is Domain.
if you get the domain then the problem is only with the command itself.
BTW, in your last reply add the ^ mark just before the | mark in the command you entered.

Hi Sam2009,

If you re-read my response, you will see that I am talking about the situation where you have the IP address and want to get a hostname back.

You seem to be wanting something like:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

> GiveMeYourName 123.123.123.123

ThisIs 123.123.123.123: My name is www.example.com

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

There cannot always be a single response to such a query for a given IP.

Moreover, there is no reason why any given IP has to have ANY hostname.


Alan.
Avatar of SAM2009

ASKER

Hi Alan,

Yes in DSN you can put many hostname and the A record can point to more than 1 Ip adr but in the server itself it can just link to one domain no?

Like:

Exemple.com  123.123.123.123
Exemple.net    123.123.123.124


If we go directly to the server maybe the  name is SERVER1.Domain.com. I just the domain name  on the server not the info from DNS.
Hi Sam2009,

Are you talking about 100 servers all being members of various Windows Server Domains, or are you talking about 100 servers on the net for which you have IP addresses, and you want to know what domain(s) they are serving on behalf of?

Also, you have variously asked about domains and hostnames - they are different.

If you are talking about Windows Server Domains, then you could have (for example):

server1.mydomain1.local
server2.mydomain1.local
server3.mydomain2.local

In that example, there are three hostnames across two Windows Server Domains (which might, or might not have a trust relationship between them).

If you are talking about internet domains, then you could have (for example):

www.example.com on 123.123.123.123
smtp.example.com on 123.123.123.123

OR

www.example.com on 123.123.123.123
smtp.example.com on 123.123.123.124
www.invalid.com on 123.123.123.123
smtp.invalid.com on 123.123.123.124

In the first of those two examples, you could say, in a sense, that the domain (example.com) is hosted on 123.123.123.123 (although even then, you'd have to check where the authoritative nameservers for example.com are located).

In the second example, both 'domains' are (at least partially) hosted on 123.123.123.123 (and also 123.123.123.124).


I am picking you mean the former (Windows Server Domains), but best to check I guess!

Does that help?

Alan.
Avatar of SAM2009

ASKER

That I'm  talking about Windows Server Domains. Ya I see you mean that same IP adr can be assigned to different servers in differerent domains right? But it is not the case there is trust between all domains and just unique IP is assigned to servers.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

Thank you for all your suggestions!