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
LVL 47
noxchoGlobal Support CoordinatorAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jss1199Connect With a Mentor Commented:
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.