• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1499
  • 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
 
noxchoGlobal Support CoordinatorAuthor 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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jss1199Commented:
Correct as to dism
0
 
noxchoGlobal Support CoordinatorAuthor 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
 
noxchoGlobal Support CoordinatorAuthor 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
 
noxchoGlobal Support CoordinatorAuthor Commented:
Very good advice! Thank you very much.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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