0

I am attempting to change the BIOS battery charging settings with PowerShell and will eventually deploy it using Intune. I am interested in doing this because I have some users that leave their computers plugged in full-time and it ruins the battery within a year. Changing this setting will only allow the computer to charge up to a specified limit which will hopefully increase the batteries overall lifespan.

I am having issues with my code which is giving me a "The Term ' ' is not recognized as the name of a cmdlet, functions, script file, or operable program". I am using the following documentation to create the script and am using an HP computer that has been verified to have this setting in the BIOS.

https://developers.hp.com/hp-client-management/blog/managing-battery-health-settings-hpcmsl-and-intune

$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

For the purpose of this exercise I don't really need to test the detect script because I already know what this setting is set to. Does anyone know what I am doing wrong? The script also failed when I saved it as a .ps1. I have a feeling there is something very basic that I am missing because I am new to powershell.

John
  • 11
  • 3
  • I guess you need to install the [HP Client Management Script Library](https://hpia.hpcloud.hp.com/downloads/cmsl/hp-cmsl-1.6.2.exe), see: [Download Library](https://www8.hp.com/us/en/ads/clientmanagement/download.html) – iRon Feb 23 '21 at 15:56
  • You should be able to get the health status using just wmi, regardless of make/model. – Abraham Zinala Feb 23 '21 at 17:52

1 Answers1

0

Sounds like you don't have the HP Powershell module installed.

The command Get-HPBIOSSettingValue and Set-HPBIOSSettingValue are not native to Windows - you'll need to download the relevant HP module and install it - try Powershell Gallery.

Scepticalist
  • 3,737
  • 1
  • 13
  • 30
  • This was the issue. I am now able to push the battery profile via intune using the Powershell script above. I had to package the HP Client Management Script Library as a Win32 application in Intune and this worked. – John Feb 23 '21 at 20:46