powershell - 使用 Powershell 获取远程计算机的操作系统名称
问题描述
我知道有很多命令可以通过 PowerShell 获取 Windows 版本,但我想获取远程计算机(在我的域中)的操作系统名称(例如它可以是 Linux)。我如何在 PowerShell 中做到这一点?
解决方案
$ttl = Test-Connection $Computer -BufferSize 16 -Count 1 -ea 0 | select -exp ResponseTimeToLive
if($ttl -lt 65){$system = "Linux"} elseif($ttl -gt 126){$system = "Windows"}
推荐阅读
- npm - 我如何在议程工作中通过约会形式
- github - Github Actions v4 API?
- reactjs - REACT :尽管没有错误,但仍为空渲染
- visual-studio - 以静默模式部署 Visual C++ 2005 速成版
- javascript - 当页面上的内容较少并且由于内容较少而网页上没有页面滚动时,scrollintoview 是否有效
- python - 查找管道中的MongoDB elemMatch?
- distributed-computing - 等待所有具有给定名称的 LSF 作业,覆盖 JOB_DEP_LAST_SUB = 1
- sql - 使用 SQL 在 MS Access 中将主键两次作为外键引用会导致错误
- android - 如何在真实设备上在慢速互联网上进行 Android 应用程序测试?
- c# - SendMessage C++ 只发送数字而不是字母