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.
$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.