Loading...

Get Lenovo device warranty info (expired or active) with PowerShell


In this post I will show you how to use only PowerShell to know if a Lenovo device warranty is expired or active using only the serial number.


The solution

The script uses only PowerShell and some web scrapping method to get the warranty information. Here we don't use any module or 3rd party app like Vantage.

You just need to specify a serial number to identity the device.

Of course it should be the serial number of the device for which you want to check the warranty.

When you go on the Lenovo website to check the warranty, you have to specify the serial number as below:


Then it will show you the warranty status:


Now you just need to use the F12 developer mode to know what is done behind.

The script here works for any device and you don't need to be on the device to get the warranty information.


Proceed with PowerShell

Now let's check the warranty status of a device and see how to do the same with PowerShell.

The first step is to specify a serial number as we have done before:


See below the PowerShell way:

Here the result we get:


We need the to get the ID to get the full URL for the next step:


Then the warranty URL for this device will be the following one:

https://pcsupport.lenovo.com/us/en/products/LAPTOPS-AND-NETBOOKS/THINKPAD-T-SERIES-LAPTOPS/THINKPAD-T14S-GEN-2-TYPE-20WM-20WN/20WN/20WNS7M800/PC2JLMMR/warranty

When you type the serial number and click on verify it will display warranty info as below:


Now with PowerShell we will do a request on the warranty URL we have mentioned before:

Then we need to get the content information to get all warranty info:



Get the script
Click on the below GitHub picture to get the script

How works the script ?

The script is called Get-LenovoWarranty.ps1

To get the warranty status for a specific device you just need to add the serial number as parameter as below:

If you want to get the warranty status of the current device, just add switch -ThisDevice as below:

This will show info as below:



What's next ?

In the next posts I will show you:

- An Azure Automation runbook to get the warranty status for all Lenovo devices

- A Log Analytics dashboard to get warranty status for all your Lenovo devices

- An Azure Automation runbook that will add Lenovo devices with expired warranty in a specific Entra ID group


See below an overview of the Lenovo warranty dashboard:


slider 404148571880308747

Enregistrer un commentaire

Accueil item

Award

Sponsors

Learn KQL in one month

You want to support me ?

Mes articles en français

Books in French


Stats