0

I need to get the specific value from powershell output. I need to get the numeric values in poewershell only.

$result =WMIC PATH Win32_Battery Get EstimatedChargeRemaining Output

1
  • 3
    Why not use a builtin PowerShell cmdlet for this instead of WMIC? Commented Apr 21, 2022 at 4:49

1 Answer 1

3

Instead of using wmic you can use a PowerShell built-in cmdlet to query WMI and CIM:

(Get-CimInstance -ClassName Win32_Battery).EstimatedChargeRemaining

See Get-CimInstance for Official Documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.