I had to check all hosts in a list , if its windows or unix.
Here's what helps identify whether it is Unix or Windows,
Note: Our Windows systems did not have ssh daemon running,
bash-2.03$ cat checkos.sh
for host in `cat list_of_host`
if version=`(sleep 1 ; echo "") | telnet $host 22 | grep -i SSH`
echo "$host $version" >> HOSt-SSH-Running
echo "$host" >> HOST-SSH-Not-running
The above scripts verify if the list of host in file has ssh daemon
running on port 22, in case if it finds running then it appends
that host to HOSt-SSH-Running and rest in HOST-SSH-Not-running.