Get Lenovo Warranty info automatically

Hey all so I have a sript that pulls a lot of info and throws it in a DB. Till recently I was also able to pull the warranty end date of Lenovo machines.

I used this:

$URL = "https://services.lenovo.com/ibapp/il/WarrantyStatus.jsp?type=$($Win32.Model)&serial=$($BIOS.SerialNumber)"
$WebRequestResult = Invoke-WebRequest -Uri $URL
$TDTagNames = $WebRequestResult.ParsedHtml.getElementsByTagName("TD")
foreach ($TDTagName in $TDTagNames) {
    if (($TDTagName.innerHTML -match "\d{4}-\d{2}-\d{2}") -and ($TDTagName.width -eq 120)) {
        $Warranty = $TDTagName.innerHTML
        break
    }
}

It looks like now that URL does not work anymore for some reason. So my question is does anyone know of an automated way to get this info? Is it possible to take a web page and insert info in a text box, submit that, and filter the return info for the date? I've been trying this on this webpage with no luck: http://support.lenovo.com/us/en/warrantylookup

Thanks for any help!! From what I've seen the method I was using was a standard way of doing it but it looks like Lenovo is not supporting it anymore. Thanks!


July 23rd, 2015 1:37pm

I think I'm on to something but would love some help

$ie = new-object -com "InternetExplorer.Application"
$ie.navigate("http://support.lenovo.com/us/en/warrantylookup")
$ie.visible = $true
while($ie.busy) {sleep 1}

$doc = $ie.document
$doc.getElementById("serialCode").value="MJCTV84"
$doc.getElementById("warrantySubmit").click

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 1:49pm

Ask in Lenovo forum for the location of the web service for the warrantees.  You should be able to get all warrantees in XML for a registered customer.

Use: New-WebServiceProxy to extract the information.

July 23rd, 2015 1:54pm

Here is the batch lookup site: https://csp.lenovo.com/ibapp/il/WarrantyLookupBatch.jsp

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 1:55pm

Okay thanks JRV I'll look into that. 
July 23rd, 2015 1:56pm

Here is the batch lookup site: https://csp.lenovo.com/ibapp/il/WarrantyLookupBatch.jsp

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 2:01pm

here is how to do it with the web query:

Just supply model and serialnumber

$URL = "https://services.lenovo.com/ibapp/il/WarrantyStatus.jsp?type=$($Model)&serial=$($SerialNumber)"

 

http://www.scconfigmgr.com/2015/03/21/get-lenovo-warranty-information-with-powershell/

July 23rd, 2015 2:02pm

You could do something with Invoke-WebRequest 

a quick example this would get the info from the vendore you populate the form and you post it back you should get the answer in the $resp so just have to filter it down.

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup
$form = $test.Forms[4].fields
$Form.fields["serialCode"]="yourserialcode"
$resp = Invoke-WebRequest -uri ("http://support.lenovo.com/us/en/warrantylookup" + $form.Action) -Method POST -Body $form.Fields

PS: JRV am prety sure you can fix my code to make it a lot sexier :)

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 2:03pm

here is how to do it with the web query:

Just supply model and serialnumber

$URL = "https://services.lenovo.com/ibapp/il/WarrantyStatus.jsp?type=$($Model)&serial=$($SerialNumber)"

 

http://www.scconfigmgr.com/2015/03/21/get-lenovo-warranty-information-with-powershell/

July 23rd, 2015 2:11pm

You could do something with Invoke-WebRequest 

a quick example this would get the info from the vendore you populate the form and you post it back you should get the answer in the $resp so just have to filter it down.

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup
$form = $test.Forms[4].fields
$Form.fields["serialCode"]="yourserialcode"
$resp = Invoke-WebRequest -uri ("http://support.lenovo.com/us/en/warrantylookup" + $form.Action) -Method POST -Body $form.Fields

PS: JRV am prety sure you can fix my code to make it a lot sexier :)

$url= "https://services.lenovo.com/ibapp/il/WarrantyStatus.jsp?type=$Mode)&serial=$SerialNumber"

Invoke-WebRequest $url

Give me a valid type and serial number and I will give yuo a working example.  I havenolenoveboxes.

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 2:12pm

You could do something with Invoke-WebRequest 

a quick example this would get the info from the vendore you populate the form and you post it back you should get the answer in the $resp so just have to filter it down.

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup
$form = $test.Forms[4].fields
$Form.fields["serialCode"]="yourserialcode"
$resp = Invoke-WebRequest -uri ("http://support.lenovo.com/us/en/warrantylookup" + $form.Action) -Method POST -Body $form.Fields

PS: JRV am prety sure you can fix my code to make it a lot sexier :)

$url= "https://services.lenovo.com/ibapp/il/WarrantyStatus.jsp?type=$Mode)&serial=$SerialNumber"

Invoke-WebRequest $url

Give me a valid type and serial number and I will give yuo a working example.  I havenolenoveboxes.

July 23rd, 2015 2:15pm

Use this one MJCTV84 provided by the Original poster
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 2:16pm

You can also see the last comment on that page: http://www.scconfigmgr.com/2015/03/21/get-lenovo-warranty-information-with-powershell/ by Casey Robertson that they are getting the same error. The site seems to not have worked starting this month.
July 23rd, 2015 2:32pm

Lenovo has changed the site too block automation.  They don't want it.  They have added the batch query.  Just upload a spreadsheet occasionally and get all warranty info in one batch.

Your purchasing department needs to add an admins email to the warranty notification alerts.

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 2:45pm

Here you go this is working 

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
$form = $test.forms[4]
$form.Fields["serialCode"]="MJCTV84"
$answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
$answer.AllElements|where class -eq "reset"|Select -First 1 -ExpandProperty innerText

Now this come out whit all the info you need

Hope this help


July 23rd, 2015 2:47pm

Hey Frederick thanks for the answer. Is there anyway to clean it up to just say the expiration date?
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 2:58pm

Okay it's so close thanks for all the help so far everyone!

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
$form = $test.forms[4]
$form.Fields["serialCode"]="MJCTV84"
$answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
$answer.ParsedHtml.getElementById("warranty_result_div").outerText

This displays this 

Start Date: 
2010-03-18 
End Date: 
2013-03-27 
Warranty Type: 
36Y 
Status: 
Expired 
Serial Number: 
MJCTV84 
How can I just get the 4th line? Thanks for all the help again!!
July 23rd, 2015 3:19pm

This seems like it works fine I doubt the output will ever change so the substring should work. Thanks for all the help!! I'll mark Frederick as the answer and thanks for the help JRV. I know officially Lenovo doesn't support it but while I can I really want to get this info automatically with no human error. Everything else in the DB is automatically pulled in. If anyone has a prettier way of doing it I would love to see. Thanks!!

Here's what I ended up with:

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
    $form = $test.forms[4]
    $form.Fields["serialCode"]="$($serial)"
    $answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
    $a = $answer.ParsedHtml.getElementById("warranty_result_div").outerText
    $a.Substring(39,10)

  • Marked as answer by Cody_Horton 11 hours 14 minutes ago
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 3:53pm

Apparently SaS provides this for both Lenovo and IBM.  IBM has already changed their warranty search and provided a protected service for customer access.  I suspect that Lenovo will not be far behind.
July 23rd, 2015 4:08pm

Okay awesome that's good to hear. Well I'll use this as a bandage till that time comes. Thanks for all the help JRV.
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 4:19pm

You are welcome.  I suggest polling Lenovo to see if they may have already implemented the web service.

July 23rd, 2015 4:22pm

Here you go this is working 

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
$form = $test.forms[4]
$form.Fields["serialCode"]="MJCTV84"
$answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
$answer.AllElements|where class -eq "reset"|Select -First 1 -ExpandProperty innerText

Now this come out whit all the info you need

Hope this help


Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 6:40pm

Here you go this is working 

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
$form = $test.forms[4]
$form.Fields["serialCode"]="MJCTV84"
$answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
$answer.AllElements|where class -eq "reset"|Select -First 1 -ExpandProperty innerText

Now this come out whit all the info you need

Hope this help


July 23rd, 2015 6:40pm

Here you go this is working 

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
$form = $test.forms[4]
$form.Fields["serialCode"]="MJCTV84"
$answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
$answer.AllElements|where class -eq "reset"|Select -First 1 -ExpandProperty innerText

Now this come out whit all the info you need

Hope this help


Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 6:40pm

Hey Frederick thanks for the answer. Is there anyway to clean it up to just say the expiration date?
  • Edited by Cody_Horton Thursday, July 23, 2015 6:57 PM
July 23rd, 2015 6:51pm

Hey Frederick thanks for the answer. Is there anyway to clean it up to just say the expiration date?
  • Edited by Cody_Horton Thursday, July 23, 2015 6:57 PM
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 6:51pm

Hey Frederick thanks for the answer. Is there anyway to clean it up to just say the expiration date?
  • Edited by Cody_Horton Thursday, July 23, 2015 6:57 PM
July 23rd, 2015 6:51pm

This seems like it works fine I doubt the output will ever change so the substring should work. Thanks for all the help!! I'll mark Frederick as the answer and thanks for the help JRV. I know officially Lenovo doesn't support it but while I can I really want to get this info automatically with no human error. Everything else in the DB is automatically pulled in. If anyone has a prettier way of doing it I would love to see. Thanks!!

Here's what I ended up with:

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
    $form = $test.forms[4]
    $form.Fields["serialCode"]="$($serial)"
    $answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
    $a = $answer.ParsedHtml.getElementById("warranty_result_div").outerText
    $a.Substring(39,10)

  • Marked as answer by Cody_Horton Thursday, July 23, 2015 7:55 PM
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 7:46pm

This seems like it works fine I doubt the output will ever change so the substring should work. Thanks for all the help!! I'll mark Frederick as the answer and thanks for the help JRV. I know officially Lenovo doesn't support it but while I can I really want to get this info automatically with no human error. Everything else in the DB is automatically pulled in. If anyone has a prettier way of doing it I would love to see. Thanks!!

Here's what I ended up with:

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
    $form = $test.forms[4]
    $form.Fields["serialCode"]="$($serial)"
    $answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
    $a = $answer.ParsedHtml.getElementById("warranty_result_div").outerText
    $a.Substring(39,10)

  • Marked as answer by Cody_Horton Thursday, July 23, 2015 7:55 PM
July 23rd, 2015 7:46pm

This seems like it works fine I doubt the output will ever change so the substring should work. Thanks for all the help!! I'll mark Frederick as the answer and thanks for the help JRV. I know officially Lenovo doesn't support it but while I can I really want to get this info automatically with no human error. Everything else in the DB is automatically pulled in. If anyone has a prettier way of doing it I would love to see. Thanks!!

Here's what I ended up with:

$test = Invoke-WebRequest -uri http://support.lenovo.com/us/en/warrantylookup -SessionVariable ln
    $form = $test.forms[4]
    $form.Fields["serialCode"]="$($serial)"
    $answer = Invoke-WebRequest -Uri ("http://support.lenovo.com" + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields
    $a = $answer.ParsedHtml.getElementById("warranty_result_div").outerText
    $a.Substring(39,10)

  • Marked as answer by Cody_Horton Thursday, July 23, 2015 7:55 PM
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 7:46pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics