求一个批量获取服务器启动时间脚步,类似 systeminfo 结果里面的 system boot time


PowerShell交流中心 › 分类: Powershell基础 › 求一个批量获取服务器启动时间脚步,类似 systeminfo 结果里面的 system boot time
0 赞 踩
jun_zhang asked 11 年 ago
0 Answers
1 赞 踩
Mooser Lee 管理员 answered 11 年 ago
$computer = “LocalHost”
$namespace = “root\CIMV2”
$a = Get-WmiObject -class Win32_OperatingSystem -computername $computer -namespace $namespace
$a | gm
$a.lastbootuptime

思路是:WMI对象:Win32_OperatingSystem
如果要现成脚本,这里有:
Get-Uptime PowerShell Script