Managing battery health settings with Microsoft Endpoint Manager and HP Client Management Script Library (HPCMSL)

In a previous blog entry, we showed how we could deploy HP Client Management Script Library to Microsoft Endpoint Manager. Let's now look at how we'd use it to perform a simple client management operation.

Suppose you are faced with a situation where your workforce may be experiencing a shift to working from home, and notebooks find themselves plugged in most of the time. Although this is convenient, having devices on AC for a majority of the time can adversely affect battery health. HP discusses this in a recently release bulletin:

| HP Business PCs - Using the Battery Health Management Feature

Let's look at how to ensure that all your devices are set to "Let HP manage my battery charging", via the Intune Proactive Remeditation feature. We also cover the same subject in another post, but from a different angle.

Creating the detection and remediation scripts

We'll first create two powershell script, let's call them 'detect.ps1' and 'remediate.ps1'. The first script will be used to determine if the setting needs to be changed, and the second will be called to do the actual change.

First, create our detect.ps1 and save it:

$setting = Get-HPBIOSSettingValue -Name "Battery Health Manager"
if ($setting -eq "Let HP manage my battery charging") {
    exit 0
exit 1

and similarly, for our remediate.ps1:

$setting = Get-HPBIOSSettingValue -Name "Battery Health Manager"
if ($setting -eq "Let HP manage my battery charging") {
        exit 0
Set-HPBIOSSettingValue -Name "Battery Health Manager" -value "Let HP manage my battery charging"
exit 0

Creating the remediation package

Now switch over to your Intune Endpoint Management console, and go to Reports -> Endpoint Analytics -> Proactive Remediations. Once there, click the "Create Script Package" button:

This will begin the wizard to define your remediation.

Under the Basics tab, fill in the fields to describe your remediation, and click Next.

Under the Settings tab, select the two powershell scripts you created before (detect.ps1 and remediate.ps1). Turn on "run script in 64-bit mode", and leave the other settings off, then click 'Next':


Under the Assignments tab, target your remediation to specific device groups, as needed, and click Next.

Finally, on the Review + Create tab, review your work and click Create to complete the process.

This is about it, the remediation will run on a defined schedule (hourly, daily, or at a specific time). To review the schedule, click on the script package, you created, select Properties, and review or edit the the schedule at the bottom of the form.


**Important: This blog post is written using a preview version of the Intune Proactive Remediation, and directions or screenshots are subject to change.**

Teaser image by Burst, via

Author : txvalp