WinPE3.0 wmic Get battery status is not working

Posted on 2013-12-16
Last Modified: 2014-01-07
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.
Question by:noxcho
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 19

Accepted Solution

jss1199 earned 500 total points
ID: 39721778
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).
LVL 19

Expert Comment

ID: 39721781
Meant to add the cmd to load the driver:

drvload %SystemRoot%\Inf\Battery.inf
LVL 47

Author Comment

ID: 39722099
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?
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

LVL 19

Expert Comment

ID: 39722117
Correct as to dism
LVL 47

Author Comment

ID: 39725154
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:
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?
LVL 47

Author Comment

ID: 39726284
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.
LVL 47

Author Closing Comment

ID: 39761478
Very good advice! Thank you very much.

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question