Well, this type of thing is not foolproof, keep that in mind.
But one way you can accomplish this is by using "OS Fingerprinting", where you run an application that connects to all machines on a subnet, and examines the IP packets they send back.
It turns out that different operating systems (including the os on devices like routers and switches) all reply a little differently. It is possible to tell a Cisco router from a Win2K server in this method.
The tool you will want to use this is NMAP. One of its many features is OS fingerprinting.
www.insecure.org/nmap
hope this helps