drqrdkfue521903877 2012-04-27 16:23
浏览 219

远程检查机器是Windows还是Linux的最佳方法是什么?

I don't know if this or Server Fault is the best place to put this question. I'm going to put it here since the method I'm describing is being launched via a PHP script.

I want to remotely check from one machine on a network, whether another machine on that network is a windows machine or a linux machine. I know the login information of the target machine.

I'm using proc_open in PHP to run plink to launch the ls command. This is cross platform (which I want) because there's a windows and a linux plink. If it succeeds and I get an output then the machine is a linux machine. If it fails then I assume its windows. I can safely assume that the windows machines aren't running OpenSSH in cygwin.

The problem is that on some windows machines, the timeout before it fails against a windows machine takes FOREVER. I need something a little quicker that is still reliable and is easy to just put into a script. Can anyone think of anything equivalent?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题