Windows system uptime

Windows System Uptime

See the number of days an endpoint is up


This agent procedure was created because several Kaseya VSA users mentioned to me that they rather see the number of days an endpoint is up rather than seeing when the last reboot happened. This is a simple agent procedure that gets the System Uptime in days using a single PowerShell command then documents the result in the Agent Logs and in a Custom Field so you can see its status and even report on it.

It is important to understand that this will show the number of days since the last time the endpoint was booted up. This is useful for servers since they are normally always on. However, keep in mind that if you are doing this for workstations, it will not start counting after a machine woke up from hibernation, woke from sleep, or a laptop that the lid was closed then opened again… It will always show the number of days since the operating system was booted up.

  • Name: Sidney Sahdala
  • Company: Kaseya
  • Website:
  • Contact Developer
  • Summary
  • Windows System Uptime
  • Version: 1.0
  • Initially Released February 24th, 2020
  • Reviews

    Windows System Uptime has no reviews.

    Gravatar for Jack Senesap
    Jack Senesap 6 months ago

    I need a procedure script to reboot an endpoint based of uptime. For example if uptime is greater then x days, request a reboot or idle check then reboot.

    Gravatar for Alvaro Pleitez
    Alvaro Pleitez 6 months ago

    Hey Jack, I build a procedure that can do this. For us checks If the system uptime is greater than 5, if so it asks the users to reboot or postpone. They have the ability to postpone for 2 hours as long as they want, however, the more they postpone the more annoyed they get because of the message. 

    Do not see an option to upload the XML so feel free to email me at

    Gravatar for Todd Reibling
    Todd Reibling 5 months ago

    I am seeing this only working on Windows 10.  Windows 7 shows as unsupported OS.  Am I missing something?

    Gravatar for Alastair Sutherland
    Alastair Sutherland 5 months ago

    Hi Todd,

    Yeah, Cim-Instance won't work on Win7 for this.  Win7 has PowerShell 2.0 natively. So you'd have to install the WMF to get later versions of PowerShell on the computer (more here:  Probably not worth it.

    But you can use wmi to get the days on either Win7 and Win10:

    ((Get-Date) - ([System.Management.ManagementDateTimeconverter]::ToDateTime((Get-WmiObject  Win32_OperatingSystem -Namespace root/CIMV2).LastBootUpTime))).Days

    Good luck. 

    Gravatar for Chris Andrews
    Chris Andrews 5 months ago


    Isn't get-date and Get-wmiObject powershell commands? 

    I tried pasting your last line into wmic from the command prompt and it failed. But pasting it into a Windows 10 powershell prompt worked.