Is there a way to automatically disconnect a notebook from the eletrical power-supply?

7

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...

Diogo

Posted 2012-06-04T14:41:50.330

Reputation: 28 202

I wonder if a power management profile might work here - i need to check what vanilla windows 7 supports tho – Journeyman Geek – 2012-06-04T14:48:13.420

2"weird and useless" isn't that 98% of the internet.....Interesting question, +1 – Moab – 2012-06-04T15:04:10.537

Answers

5

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.

Tamara Wijsman

Posted 2012-06-04T14:41:50.330

Reputation: 54 163

1

I guess you wanted a computer-controlled power supply, not one with master (current detect)/slave? Here's one such: http://www.controlbyweb.com/webswitch/

– Ben Voigt – 2012-06-04T16:12:19.880

The one I linked does such thing, and is merely example. He should be eventually able to find one himself. – Tamara Wijsman – 2012-06-04T16:15:00.250

1

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.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa393485(v=vs.85).aspx

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: http://www.robvanderwoude.com/files/battstat_xp.txt

에이바

Posted 2012-06-04T14:41:50.330

Reputation: 1 266

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 – 2012-07-10T19:27:18.190

1

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.)

octern

Posted 2012-06-04T14:41:50.330

Reputation: 285