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 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试,帮帮忙吧
    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建