Home > PowerShell > Get Uptime of Microsoft Windows Operating System using PowerShell

Get Uptime of Microsoft Windows Operating System using PowerShell

There are variety of ways and tools available for generating uptime of a windows XP/2003 machine. This post describes the procedure for generating uptime with powershell code. You can use this code in your powershell scripts without depending on third-party tools/utilities.
$os = Get-WmiObject -cl win32_operatingsystem
write-host ((Get-date) – $os.converttodatetime($os.lastbootuptime))”(DD.HH:MM:SS)” | fl
Copy and paste this to your powershell window and format the output like you want.
Happy Learning,
Sitaram Pamarthi
Categories: PowerShell
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>