首页 > 解决方案 > 使用 Powershell 获取远程计算机的操作系统名称

问题描述

我知道有很多命令可以通过 PowerShell 获取 Windows 版本,但我想获取远程计算机(在我的域中)的操作系统名称(例如它可以是 Linux)。我如何在 PowerShell 中做到这一点?

标签: powershelloperating-system

解决方案


$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"}

推荐阅读