Windows 10: powercfg problem

  1.    24 May 2016 #1

    powercfg problem


    I have a powershell script that calls powercfg -lastwake. Every now and then it will not return any data. The code below
    Checks the return value $wake for null. If null it calls powercfg again. The other day I checked the system and the $try was at 2448. I did a ctrl-c which killed the powershell script. I then typed powershell -lastwake and got a good result.

    My question is why does it some times fail to return an data?

    Thanks
    RAC

    $try = 0
    do {
    $wake = powercfg -lastwake
    Start-Sleep -Seconds 5
    $try += 1
    Write-Host "Wake tries: $try"
    } while ($wake -eq $null)
      My ComputerSystem Spec

  2.    24 May 2016 #2

    Hi, works for me- can only think maybe sthg is delaying the processing- was your system idle? But 5s is quite long.. hmm.
      My ComputerSystem Spec

  3.    24 May 2016 #3

    dalchina said: View Post
    Hi, works for me- can only think maybe sthg is delaying the processing- was your system idle? But 5s is quite long.. hmm.
    It works for me most of the time. But 2448 times 5 seconds part is 3.4 hours. Nobody was on the system. The system woke up at 8:00 AM for the next 3.4 hours every 5 seconds it failed to get a valid response from powercfg -lastwake. Yet if I open a command prompt and enter the command it works.
      My ComputerSystem Spec


 

Related Threads
Hello Windows 10 Community, I'm currently in the process of finalizing my Windows 10 install by configuring all the little details I typically do, but for some reason I cannot get my computer to sleep after the specified time in the Control...
Password problem or Windows Live Account problem in User Accounts and Family Safety
Cannot remember password, OR typed it in wrong on both entries. When I use the tool for recovering/resetting the password. The system takes me to a reset function, where I am able to put in a new password twice, but the screen that follows does not...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:08.
Find Us