Solved

WinPE3.0 wmic Get battery status is not working

Posted on 2013-12-16
7
1,208 Views
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.
Thanks
0
Comment
Question by:noxcho
  • 4
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
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).
0
 
LVL 19

Expert Comment

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

drvload %SystemRoot%\Inf\Battery.inf
0
 
LVL 46

Author Comment

by:noxcho
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?
0
Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

 
LVL 19

Expert Comment

by:jss1199
ID: 39722117
Correct as to dism
0
 
LVL 46

Author Comment

by:noxcho
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: 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
 
LVL 46

Author Comment

by:noxcho
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.
0
 
LVL 46

Author Closing Comment

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

Featured Post

Do email signature updates give you a headache?

Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

Suggested Solutions

Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now