Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7184259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:09:47+00:00 2026-05-28T18:09:47+00:00

I wanted a windows service I’m building to run overnight. So I changed my

  • 0

I wanted a windows service I’m building to run overnight. So I changed my power options and set my computer to never sleep. Started the windows service and went home. This morning I found my computer sleeping and was curious if someone manually put it to sleep after I left. Is there a log file or some way to find the last time my computer went to sleep? I’m using a Windows 7 operating system.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:09:48+00:00Added an answer on May 28, 2026 at 6:09 pm

    Have you consulted Event Viewer? To start Event Viewer by using a command line

    • Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories and then click Command Prompt.
    • Type eventvwr.

    Information about scheduled / unscheduled sleeps and reboots should be found by expanding the tree view in the left plan to Event Viewer > Windows Logs > System.

    You can also get the last boot time by using the WMI service object to query the LastBootUpTime property of the Win32_OperatingSystem class. Note that the returned date is in WMI date time format which you’ll need to use tools to convert into a human readable date.

    Here’s a VBScript sample:

    ' LastBoot.vbs
    Option Explicit
    Dim wmiService, objDateTime, OS
    Set wmiService = GetObject("winmgmts://localhost/root/cimv2")
    Set objDateTime = CreateObject("WbemScripting.SWbemDateTime")
    Set OS = wmiService.ExecQuery("SELECT * FROM Win32_OperatingSystem").ItemIndex(0)
    WScript.Echo OS.LastBootUpTime ' Example: 20180801131622.495364+660
    objDateTime.Value = OS.LastBootUpTime
    WScript.Echo objDateTime.GetVarDate ' Example: 01/08/2018 12:16:22 PM
    

    Here’s a PowerShell example:

    (Get-WmiObject Win32_OperatingSystem).LastBootUpTime
    # Outputs: 20181009160558.495300+660
    
    (gcim Win32_OperatingSystem).LastBootUpTime
    # Outputs: Wednesday, 1 August 2018 12:16:22 PM
    

    Here’s a Command Prompt example (uses PowerShell):

    powershell -command "(Get-WmiObject Win32_OperatingSystem).LastBootUpTime"
    REM Outputs: 20180801131622.495364+660
    
    powershell -command "(gcim Win32_OperatingSystem).LastBootUpTime"
    REM Outputs: Wednesday, 1 August 2018 12:16:22 PM
    

    References:

    • https://learn.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-operatingsystem
    • http://powershell-guru.com/powershell-tip-7-convert-wmi-date-to-datetime/
    • https://www.thewindowsclub.com/find-system-uptime-windows
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a Windows Form that includes a combo box control, and I wanted
How to make your c# app work as windows service? (matereals, todos wanted)
I wanted to install pgAgent service on windows. Though it installs alright using the
I found this post, windows service startup timeout But just wanted to clarify, I
I wanted to implement a windows service that captures dropped flat delimited files to
I have an executable that is started by a windows service, this program will
I wanted to know if an Odata service can be hosted as a windows
My problem is multi-layered. I wanted to write a windows service that executes a
I wanted to try a program distributed in source for *nux on Windows. It's
I wanted to use winreg module of python for working with windows registry. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.