Jul 11, 2014 at 10:37 PM
Edited Jul 12, 2014 at 7:22 PM
In March 2014, Lenovo issued a recall for certain batteries shipped with specific models of their ThinkPad line of laptops (or purchased afterwards as accessories). You can read about the recall here:
They provide an enterprise tool which can be silently deployed to affected machines, but the enterprise tool only creates a .csv file for each machine with the details about the battery in it. An admin needs to gather these up and email them to a Lenovo rep
to have them check whether the battery in each machine is affected.
For various reasons, that didn't sound like a good solution to me. I decided it would be better to notify the user that the battery in their laptop needed to be tested, then run Lenovo's tool in "consumer mode". This sends the battery serial number
to a web site which informs the user whether their battery has been recalled. I thought this might be a good first project to try out the toolkit.
Here's the script:
Save LenovoBattery.exe (download link
) to the Files folder. You'll want to deploy as a Package rather than as an Application. Enable the "Allow the user to run
the program independently of assignments" option so the user can run the tool again through the Software Center if they have an additional battery to test.
I posted a WQL query in
this thread on the Lenovo forums
which should find all of the standard machines which may be affected. (Special bid machines may have a different model number and thus would not be found by this query.) Use this to create the device collection you deploy
the Package to.
Here's how it works: first the script verifies that the client can connect to
(which is the site the tool uses to verify whether the battery is eligible for recall). If the site cannot be reached, the script terminates with errorcode 1. Otherwise, the script displays a dialog to the user explaining
what they will see when the tool runs. When the user clicks OK, the script runs LenovoBattery.exe with the /silent switch, which installs the tool and runs it.
The tool itself will either display a dialog saying that the battery is not affected or launch a browser window, which will either display "The battery is not eligible for replacement" or "The battery is eligible for replacement", in which
case the user needs to click "Continue" and fill in their details to arrange to be shipped a replacement battery.
As soon as the tool finishes running, the script performs a silent uninstall of the tool since it is no longer needed. A final dialog is displayed to the user.
You should customize the messages displayed before and after the tool is run by editing the $message and $message2 here-strings.
A couple issues I encountered: I tried using Show-InstallationPrompt to display the messages to the user but the text was cut off, which I why I ended up using Show-DialogBox instead. I was also going to use Test-NetworkConnection rather than specifically validating
that the site was available, but I found that function falsely reported "no connection" on my test machine which did in fact have a connection available. I'll file a bug for that when I'm able to further investigate why it didn't work.
Anyway, hope this is useful to someone. It was a good project for my first PSAppDeployToolkit deployment! Feedback is welcome.