Using remote WMI to monitor win32_battery

0

My ultimate goal here is to remotely monitor the EstimatedChargeRemaining on a tablet PC. I have it mostly working, and it seems I can query almost anything BUT the battery!

On the tablet I can invoke "wmic path win32_battery get estimatedchargeremaining" and get the % charge remaining. I can also query cim_battery and get two records, one for a nonexistent optional battery, and one for the battery that's actually installed. On the remote desktop where I want to do the monitoring, running those queries returns "No Instance(s) Available", of course, because it doesn't have a battery. Here are the things I've checked and done so far to get remote WMI working:

  1. The firewall is OFF aon both machines.
  2. Enabled DCOM to get past the 0x80070005 access denied error.
  3. Granted "Remote Enable" on WMI namespaces to get past the 0x80041003 permission error.

Now, on the desktop, I can run wmic and set /node:IOS,MFS where IOS is the desktop and MFS is the tablet. Any queries I run subsequently will run on both nodes. I tested it with things like "path win32_bios get description" and "path win32_baseboard get manufacturer", and they both return appropriate different information for both nodes. (I know I could use the BIOS and BASEBOARD aliases, but I wanted to use path notation for consistency with my win32_battery queries, for which there is no alias.)

But, when I run "path win32_battery get estimatedchargeremaining" it returns "No Instance(s) Available" for both nodes! And "path cim_battery get estimatedchargeremaining" returns "No Instance(s) Available" for the desktop and just ONE record for the tablet, the one for the nonexistent optional battery! Why can't I query the actual installed battery?

I'm using the default /implevel:impersonate and /authlevel:pktprivacy. I tried specifying /user: with admin credentials on the tablet, but that didn't work. I've granted "Remote Enable" to everyone on the WMI namespaces \root, \cimv2, and \power. Of course I haven't exhaustively tried querying other objects, but everything I've tried works EXCEPT the one I really want! What's the secret sauce that I'm missing?

wmi
monitor
battery
wmic
asked on Stack Overflow Aug 10, 2012 by John Seal

2 Answers

0

How do you have your user permissions configured? See this article for more information: http://technet.microsoft.com/en-us/library/cc787533(v=ws.10).aspx http://blogs.technet.com/b/askperf/archive/2007/08/14/wmi-troubleshooting-permissions.aspx

You can also run ProcMon http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx and filter on process WMIC.exe. It should show you any buried errors. Specifically look for "Desired Access:" and "Granted Access:" under the detail column.

answered on Stack Overflow Aug 10, 2012 by Solomon Seal • edited Aug 10, 2012 by Solomon Seal
0

You cannot use Command Prompt command WMIC Win32_Battery to pull this information. Instead, you must use PowerShell. The command you want to execute is...

Get-WmiObject Win32_Battery | Select-Object estimatedChargeRemaining

answered on Stack Overflow May 9, 2013 by SgtOJ

User contributions licensed under CC BY-SA 3.0