Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know this looks like weird and useless, but let me explain...

I'm running Windows Assessment and Deployment Kit (Windows ADK) to make some tests on Windows 8 Preview. One of it's assessment is the "Battery Run Down Test", which tests battery consumption with some procesor load. I'm trying to "automate" in some way this test, I mean, I wish to execute it without any human intervention (such as manually disconecting the eletric power source to leave my notebook running only from batteries to run this assessment).

So, there is some ACPI API, Windows API or even an easy bat shell/VBScript/Powershell command to do this?

Does someone already made something like?

PS: I'm asking this because I couldn't found any answer, but maybe someone here would have any tip...

share|improve this question
I wonder if a power management profile might work here - i need to check what vanilla windows 7 supports tho – Journeyman Geek Jun 4 '12 at 14:48
"weird and useless" isn't that 98% of the internet.....Interesting question, +1 – Moab Jun 4 '12 at 15:04
up vote 5 down vote accepted

This really depends on your power circuit. It's very doubtfully that it would allow you to turn of the charging functionality from the OS. There might be very rare laptops that allow one to do so but I don't think that it is a general feature.

You can however manipulate the state, either as Ava Gailliot suggested or by disablig the device:

As said in the first paragraph: This will make your OS think it's on battery, but it won't actually deplete.

You might have more success looking into a controllable UPS or Power Supply, example here.

share|improve this answer
I guess you wanted a computer-controlled power supply, not one with master (current detect)/slave? Here's one such: – Ben Voigt Jun 4 '12 at 16:12
The one I linked does such thing, and is merely example. He should be eventually able to find one himself. – Tom Wijsman Jun 4 '12 at 16:15

I've been searching the 'net and it looks as if it is possible with WMI Classes although you'll have to implement your own solution. It appears that there is a method SetPowerState that may be able to do what you're asking.

There are many scripts already available online on how to check the battery status of a machine -- they may help you with writing one to turn off the AC power. Here is one such example:

share|improve this answer
Check out the table of allowable codes for SetPowerState. It's used to put the computer to sleep, shut it off, or change the power consumption settings, not to change its power source. – octern Jul 10 '12 at 19:27

Tom suggested a controllable UPS. If you want a much cheaper, kludgier solution, you could get an X10 appliance module and USB transceiver for around $50. You can then use a script or remote login to cut or restore power to the computer.

(apologies for that link -- their website is every bit as eye-searing as it was in 1999.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .