PowerShell Check Power Adapter Connected Upgrade UEFI/BIOS – SCCM Application

The other month I was asked by one of my clients to deploy a BIOS/UEFI upgrade to the HP Elite x2 1012 G1. Now this as we all know is fine and very normal, the only issue I had was ensuring that the Power adapter was connected before running the BIOS/UEFI upgrade. This is because.. when you use the force switch on the HP upgrade utility it does not check for the Power Adapter state and also bypasses low battery and will install regardless.

So I created a script….

This script is designed to be run with the BIOS/UEFI upgrade package within.

  1. It will check first the Hardware type of the device (2 being Laptop, 1 being Desktop) making sure it is a mobile device.
  2. The script will then check the WMI property “PowerOnLine” to establish whether or not the power adapter is connected.
  3. If the Power Adapter is connected it will continue with the BIOS/UEFI upgrade (Jump to step 5)
  4. If the Power Adapter is not connected  it will warn the user 10 times before closing and informing the User to Re-Run the application from Software Center when power is available. (Warning count is customizable)
  5. The script will then identify the BIOS/UEFI version and if it is less that the version being deployed it will then warn and install the new BIOS/UEFI version.
  6. The script also does error checking around the Model of the machine.

Anyway enough already… Here is the script. As always feel free to use it but don’t forget where you got it from!

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.