powershell get server uptime
1 2 3 4 5 6 7 8 9 10 11 12 |
New-Item alias:np -value "C:\Windows\System32\notepad.exe" New-Item alias:st -value "C:\Program Files\Sublime Text 3\sublime_text.exe" function Get-Uptime { $os = Get-WmiObject win32_operatingsystem $uptime = (Get-Date) - ($os.ConvertToDateTime($os.lastbootuptime)) $Display = "Uptime: " + $Uptime.Days + " days, " + $Uptime.Hours + " hours, " + $Uptime.Minutes + " minutes" Write-Output $Display } Clear-Host Get-Uptime |
결과값
1 2 3 |
Uptime: 176 days, 14 hours, 17 minutes PS C:\Windows\system32> |