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
No comments:
Post a Comment