Good day, I have a computer running Windows Server 2016. The computer is connected to a UPS via USB where it reads the UPS' remaining charge as if it were its own battery. I need to create a batch file that checks the remaining battery charge, if it's below 60%, then shutdown a remote computer and itself (I can then use the Task Manager for a periodic execution of the batch file). I have found similar questions/answers in the forum but not exactly what I need. Any help with the script would be appreciated :).
EDIT: Thank you for your answer. I can actually get the remaning charge through the Windows Management Instrumentation, so no need to worry about drivers or whatnot. What I want to do is something like the following:
::Get the battery's remaining charge
SET BatteryCharge = WMIC PATH Win32_Battery Get EstimatedChargeRemaining
::Shutdown remote and local computer if charge is less than 60%
IF %BatteryCharge% LSS 60 (
shutdown -s -m \\remotecomputer -t 10
shutdown -s -m \\localcomputer -t 10
)
Now I'm not exactly sure how to plug the remaning battery charge to the variable BatteryCharge.