PowerShell – Retrieve System Startup Time Information

The below script gathers the following system startup time information from a local or remote client.

  • Computername
  • Last Wakeup time (from Sleep, Hibernate or Fast boot on Windows 8x clients)
    The last wakeup date/time is converted from UTC into the client local time.
  • Last Boot time
  • The Time Zone of the client
  • The system wakeup / sleep message from the Windows event log

Important: the script uses PowerShell remoting, it’s therefore required that the targeted clients have WinRM enabled.

Example:

Computer       : client1
LastWakeupTime :
LastBootTime   : 24.12.2013 12:28:41
TimeZone       : (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
Message        :

Computer       : client2
LastWakeupTime : 06.01.2014 08:33:04
LastBootTime   : 06.01.2014 08:29:08
TimeZone       : (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
Message        : The system has resumed from sleep.
                
                 Sleep Time: ?2014?-?01?-?06T07:32:42.550130000Z
                 Wake Time: ?2014?-?01?-?06T07:33:04.780800500Z
                
                 Wake Source: Device -Intel(R) 82579LM Gigabit Network Connection

Computer       : client3
LastWakeupTime : 29.12.2013 19:17:22
LastBootTime   : 06.01.2014 00:55:57
TimeZone       : (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
Message        : The system has resumed from sleep.
                
                 Sleep Time: ?2013?-?12?-?29T11:05:17.427355600Z
                 Wake Time: ?2013?-?12?-?29T11:17:22.762004000Z
                
                 Wake Source: Power Button

Computer       : client4
LastWakeupTime : 06.01.2014 10:03:57
LastBootTime   : 06.01.2014 09:55:36
TimeZone       : (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
Message        : The system has resumed from sleep.
                
                 Sleep Time: ?2014?-?01?-?06T09:01:05.727399400Z
                 Wake Time: ?2014?-?01?-?06T09:03:57.248801300Z
                
                 Wake Source: Power Button

Computer       : client5
LastWakeupTime : 13.12.2013 13:27:33
LastBootTime   : 06.01.2014 09:28:39
TimeZone       : (UTC) Dublin, Edinburgh, Lisbon, London
Message        : The system has resumed from sleep.
                
                 Sleep Time: ?2013?-?12?-?13T12:32:42.342018800Z
                 Wake Time: ?2013?-?12?-?13T13:27:33.513115200Z
                
                 Wake Source: Device -USB Root Hub

Computer       : client6
LastWakeupTime :
LastBootTime   : 06.01.2014 01:23:48
TimeZone       : (UTC+10:00) Canberra, Melbourne, Sydney
Message        :

Leave a Reply

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