Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1440
  • Last Modified:

WinPE3.0 wmic Get battery status is not working

Hello guys,

I need to get the status of laptop battery in WinPE mode. I want to know if it is charging or not.
I am using wmi for this via "C:\> WMIC Path Win32_Battery Get BatteryStatus"
but I always get the "Intance(s) not installed" error message.
I have added wmi, hta and scripting components to wim image. But still it won't work.
Who can shed me some light on this problem? This is pretty urgent.
Thanks
0
noxcho
Asked:
noxcho
  • 4
  • 3
1 Solution
 
jss1199Commented:
You need to load the battery driver in WinPE - using either drvload or installing in the PE image.

You will then get a return on your WMIC query where BatteryStatus = 2 (The system has access to AC) or BatteryStatus = 1 (The battery is discharging).
0
 
jss1199Commented:
Meant to add the cmd to load the driver:

drvload %SystemRoot%\Inf\Battery.inf
0
 
noxchoAuthor Commented:
Excellent jss1199, I will try it and post back what I get!
I can add the batter.inf driver via DISM as well to wim image, correct?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jss1199Commented:
Correct as to dism
0
 
noxchoAuthor Commented:
Ok, it worked once. I decided then to start from scratch because after many attempts my system was pretty dirty. I reinstalled WAIK3.0 and run the dism commands like here: http://www.symantec.com/connect/articles/adventures-winpe-31
Added Battery.inf (to some reason the file from my laptop was not signed!!! and I am building x86PE) but still it is not working now. Am I missing anything?
0
 
noxchoAuthor Commented:
Ok, looks like WinPE cannot load Battery.inf driver automatically and needs always drvload to be used.
Maybe Microsoft limited it to specific driver load or the driver itself does not have autoinitiate command.
0
 
noxchoAuthor Commented:
Very good advice! Thank you very much.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now