powershell get server uptime
|
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 |
결과값
|
Uptime: 176 days, 14 hours, 17 minutes PS C:\Windows\system32> |