Checking how long the machine or server is running since last reboot or maintenance is sometimes necessary. To measure the device performance or stability of the server or computer.
In Windows, PowerShell is quite handy to to check the uptime of the server.
Here's a simple code snippet to do check how long the server has been running since its last reboot.
$Last_reboot_time = Get-WmiObject win32_operatingsystem | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
$Today = Get-Date
$uptime = NEW-TIMESPAN –Start $Last_reboot_time.LastBootUpTime –End $Today
$xdays=$uptime.Days
$xhours=$uptime.TotalHours
$xhours=[math]::Round($xhours,2)
write-output ("Computer is up since last reboot for: $xdays day/s and $xhours hours")
Cheers! Take care. Till next Time.
Stay safe! and Keep things up!
Do ASAP, Always Say A Prayer...
Practice O.T.G. = Obedience To God
Make time for Prayer and Meditation.
================================
Free Android Apps:
Click links below to find out more:
Free Android Apps:
Click links below to find out more:
Excel Keyboard guide:
https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide
Heaven's Dew Fall Prayer app for Android :
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide for Android:
Pray the Rosary every day, countless blessings will be showered upon your life if you recite the Rosary faithfully.
https://play.google.com/store/apps/details?id=com.myrosaryapp
Divine Mercy Chaplet Guide (A Powerful prayer) BFF = Be Filled Faith:
Comments
Post a Comment