Shut down computer when on battery


  1. Posts : 3
    Windows 10 Home
       #1

    Shut down computer when on battery


    Hello,

    I need to be able to shut down my ASUS R517S laptop whenever it is running on battery (which is internal and cannot be removed easily). OS: Windows 10 Home.

    Why? Working in a offshore environment with a "everything-should-shutdown-if-rig-loses-power-supply-policy".

    What i've tried so far: Change advanced power settings->Battery->Set low battery level to 100% and in low battery action set to shutdown if "On battery". This does not work - when i test and unplug the power chord, i only get a bluescreen with a "low battery" warning. After this it resumes to desktop and nothing happens (also tried sleep/hibernate options - but nothing is happening).

    Any ideas?
      My Computer


  2. Posts : 42,990
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    This does not seem straightforward although it seems simple. Do you not have an IT department responsible for your equipment?

    I don't believe there's a suitable task scheduler trigger.
      My Computers


  3. Posts : 3
    Windows 10 Home
    Thread Starter
       #3

    dalchina said:
    This does not seem straightforward although it seems simple. Do you not have an IT department responsible for your equipment?

    I don't believe there's a suitable task scheduler trigger.
    This is my personal laptop, not company equipment. You are right, it cannot be automated from Windows task scheduler, currently investigating alternatives to that, but no luck yet
      My Computer


  4. Posts : 42,990
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    You could possibly trigger a shutdown from event id 327.

    If you switch your laptop to battery, noting the time, then look at your event log, you should be able to check that id.

    (I'd have thought if there's a company policy in a safety conscious environment, health and safety would have meant your company takes responsibility for all kit so it complies..)
      My Computers


  5. Posts : 3
    Windows 10
       #5

    The only thing I can think of is to write a script that constantly monitors / polls the computer to see if its using battery or not.

    Then if it is using battery issues the shutdown command.

    You'd place the script in the startup folder so it runs as soon as you boot.

    I guess you could look into using python or powershell to write this and look for a library that monitors the power useage... or put the question up on a coding site and offer some cash to get a student to write it.
      My Computer


  6. Posts : 42,990
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #6

    This would be much easier and 'cleaner':
    Shut down computer when on battery-snap-2017-06-09-11.29.38.jpg
    - assuming the event id is correct, and is generated on switching to battery.

    (There's some discussion here and there on this, so needs verification of course).

    Command e.g.
    shutdown.exe -s -t 00
    Shutdown
      My Computers


  7. Posts : 3
    Windows 10 Home
    Thread Starter
       #7

    dalchina said:
    You could possibly trigger a shutdown from event id 327.

    If you switch your laptop to battery, noting the time, then look at your event log, you should be able to check that id.

    (I'd have thought if there's a company policy in a safety conscious environment, health and safety would have meant your company takes responsibility for all kit so it complies..)
    This might work, by running shutdown.exe, but i'm not sure how i can create a trigger just from event 327
      My Computer


  8. Posts : 42,990
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #8

    Set up a task as per my #6

    But first check the event id in Event Viewer as I suggested before
      My Computers


 

  Related Discussions
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:57.
Find Us




Windows 10 Forums