/build/static/layout/Breadcrumb_cap_w.png

How do i check whether my laptop is on battery or on cable

I have a package which decrypts hard disk and then encrypts. This will be taking a lot of time. So, we do not want it to be installed when the laptop is on battery. How do i check whether the machine is on battery or cable.


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: jknox 11 years ago
Red Belt
2

It kind of depends how you are deploying your package, but there are at least a couple of ways to do it (assuming Windows):

http://blogs.technet.com/b/heyscriptingguy/archive/2007/04/09/how-can-i-tell-whether-a-laptop-computer-is-running-off-batteries.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/31/using-windows-powershell-to-determine-if-a-laptop-is-on-battery-power.aspx

 

Posted by: rileyz 11 years ago
Red Belt
2

Check this link: http://lmgtfy.com/?q=wmi+query+on+mains+or+battery&l=1

You will need to use WMI...

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ