2025年3月19日 星期三 甲辰(龙)年 月十八 设为首页 加入收藏
rss
您当前的位置:首页 > 计算机 > 系统应用 > Windows

Windows查看系统启动时长 uptime.exe

时间:05-22来源:作者:点击数:63

一、通过系统命令

cmd:

  • dir /ah /tw c:\pagefile.sys|findstr .sys
  • chcp 437
  • systeminfo | find "System Boot Time:"
  • systeminfo | findstr /C:"System Boot Time:"
  • chcp 437
  • net statistics workstation | find "since"
  • net stats work | find "since"
  • 2008R2也可以执行net stats srv| find "since"

cmd wmic:

  • wmic OS GET CSName,LastBootUpTime

powershell:

  • cmd.exe /c dir /ah /tw c:\pagefile.sys|findstr .sys
  • Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime
  • (gcim Win32_OperatingSystem).LastBootUpTime
  • (gwmi win32_operatingSystem).lastbootuptime
  • get-date
  • (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime
  • ((Get-WmiObject Win32_OperatingSystem).ConvertToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime))
  • $obj = Get-WmiObject Win32_OperatingSystem
  • $obj.ConvertToDateTime($obj.LastBootUpTime)
  • $operatingSystem = Get-WmiObject Win32_OperatingSystem
  • "$((Get-Date) - ([Management.ManagementDateTimeConverter]::ToDateTime($operatingSystem.LastBootUpTime)))"
  • function Get-SystemUptime {
  • $operatingSystem = Get-WmiObject Win32_OperatingSystem
  • "$((Get-Date) - ([Management.ManagementDateTimeConverter]::ToDateTime($operatingSystem.LastBootUpTime)))"
  • }
  • Get-SystemUptime

powershell专用命令:

  • Get-Uptime
  • Get-Uptime -Since

The Get-Uptime cmdlet was introduced in PowerShell 6.0.

https://learn.microsoft.com/en-US/powershell/module/microsoft.powershell.utility/get-uptime

二、通过第三方工具uptime.exe

  • https://neosmart.net/uptime/

三、通过微软的小工具uptime.exe

  • http://web.archive.org/web/20100316211056/http:/download.microsoft.com/download/winntsrv40/install/uptime_1.01/nt4/en-us/uptime.exe
  • https://networkproguide.com/wp-content/uploads/uptime.zip
  • https://zedt.eu/storage/2012/uptime.zip
  • http://web.archive.org/web/20070226103948if_/http://download.microsoft.com:80/download/winntsrv40/install/uptime_1.01/nt4/en-us/uptime.exe

uptime123.zip

压缩包里有微软1.0.0.1版本、codeplex uptime1.1版本以及https://neosmart.net/uptime/ 的uptime

四、通过事件ID6005的时间点

  • get-eventlog System | where-object {$_.EventID -eq "6005"} | sort -desc TimeGenerated
  • Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005 -or $_.Id -eq 6006}

五、通过sysinternals工具psinfo

  • http://live.sysinternals.com/PsInfo.exe
  • psinfo.exe -accepteula -nobanner uptime

六、powershell7特有命令

注意:2008R2不支持powershell7(虽然能安装上,但是执行报错)

https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7

https://learn.microsoft.com/zh-cn/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7

Differences between Windows PowerShell 5.1 and PowerShell 7.x

https://learn.microsoft.com/en-us/powershell/scripting/whats-new/differences-from-windows-powershell?view=powershell-7

https://learn.microsoft.com/zh-cn/powershell/scripting/whats-new/differences-from-windows-powershell?view=powershell-7

  • Get-Uptime -Since
方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门