Salt * Wet * Bytes

July 6, 2006

How do you know if a machine is running Windows?

Filed under: Networking — saltwetfish @ 11:04 am
Tags: ,

Okay, this may sound like a dumb question, especially if you are looking at the machine! However, this is one of the few questions that interviewees for Windows position are stumped by, going by my experience.The question goes:

You are only given a Windows command prompt and an IP address, what tools can you use to confirm whether this is a Windows host and not a UNIX host?

Most of the time candidates would tell you that you can use ping. Some even say nslookup.

Ping only returns an FQDN as defined by the DNS service and nslookup only queries DNS servers. In no way can you confirm with definite certain that a IP address belongs to a Window machine using these 2 tools.

The correct tool to use is Nbtstat. This tool queries the Nbt stats in a host. In general, only a Windows host will reply when you us it, a Unix/Linux host will not. However, this may not be definitive as Samba clients running on Unix could also return the Nbt stats.

To confirm, you could dir the c$\winnt directory of the host. That is “DIR \\machine\c$\WINNT”. You don’t need admin access for this. If you receive access denied or a list of files, you can be sure its a Windows client.

Alternatively to check if its a Unix client, try telnetting to the host. If telnet works, in general it means its not a Windows server. Of course, this is provide that Telnet service is not running on Windows.

Blog at WordPress.com.