Include Lenovo Warranty Information in the SCCM Hardware Inventory

Posted: May 14, 2013 in Configuration Manager, System Center Configuration Manager 2012
Tags: , ,

I’m currently working on a Configuration Manager 2012 SP1 deployment for a customer and they wanted to be able to take out reports on warranty information on their Lenovo machines. I did a search to see what’s out there, but could not find anything for Lenovo machines that actually stored the Warranty Information in SCCM. I however found a lot of reports that would include a link to the Lenovo website so you could go out and check warranty information for that specific computer, but that’s not what we wanted, we wanted to be able to generate reports based of data stored in SCCM.

I found a nice blog post that Eric Schloss wrote that does the exact ting I want for HP machines. So we ended up creating a script based on the script in the article above, but modified it to use the Lenovo Warranty website and the information needed for Lenovo machines.

There is one thing to be aware of before we begin. This process is dependent on the output from a Lenovo web site. If Lenovo updates the format of the output from the site, it could affect the processing of the data.

To describe the process of how this works in short:

  1. Run the script on the computer to pull the warranty information and store it in the registry (We included the script to run in the Task Sequence when we deploy machines, but you could also run this as an application or program to already installed computers)
  2. Modify Configuration.mof and add the Hardware Inventory Classes
  3. Create a report that uses the information collected through Hardware Inventory

You can download the script here;

The script logs its results to C:\Windows\Temp\WarrantyInfo.log


And the information is stored in the registry.


To extend the inventory of the registry, there is a great tool (RegKeyToMOFv31.exe) to download from here

Start the tool and select the registry keys you would like to add to the inventory.

Copy the syntax from the tool and paste into the “Added extensions” section of the configuration.mof located on the SCCM primary server install directory\Microsoft Configuration Manager\inboxes\clifiles.src\hinv (make a copy of the original file before you edit and save it).

Select the “to import in Admin/Agent settings….” tab of the tool and save the information to a .mof file.

After that go to the SCCM console, Administration -> Client Settings -> Hardware Inventory -> Set Classes and then click Import..

Select the file you just created and verify that the new classes are added.

Run a hardware inventory action on a client and verify that the new registry values are added to the inventory.


Now that the information is added to the inventory you can start to create reports that leverage this information, below is a basic report to give you an idea of what this could look like;


Update 1:

I’ve been contacted regarding the script that Eric Schloss have on his site for HP machines on his site, because that script is not working anymore. The reason for that is that HP has changed the Warranty lookup website since that article was published.

So I’ve also made a updated script for HP machines available that you can grab here;

Update 2:

I’ve also been asked if I could share the sample report from the posting, so I’ve made the query available for download here; ReportQuery.txt

This is a bit modified from the sample included in the original post and here is a screenshot for that. (The modification will make it easier to create pie-charts etc.

You’ll need to update the query to match your tables/views for this query to work, this is the name of the view used for Warranty Information in my setup so you must change this to match your setup; dbo.v_GS_WarrantyInformation0

The code will provide you with the table and then you can use information from there to build pie-charts etc.


  1. Jan Fernand Bosløven says:

    Tnx m8…. Nice one;-)

  2. Josiah says:

    Can you include that sample report? I’ve gotten everything to work but I’m having issues with the reporting aspect. Thanks!

  3. Any chance you have w

  4. Andrew Morris says:

    I am trying your report query and I am getting errors saying ‘conversion failed when converting date and/or time from character string.’
    So that’s the bit in your query that converts the warranty expiration dates in the table to a number of days remaining or working out the warranty status.
    Any idea on how I might fix this?

  5. Marino says:

    Any update on with Lenovo would be great if you get it to work.

  6. Dan Clark says:

    Looks like HP has modified their warranty lookup page, which breaks this process. Has anyone found a solution for pulling warranty data from HP via script?

  7. Arsalan says:

    The report is not pulling any information since it is not looking into 64 bit key, what would be the query to lookup warranty information stored in 64 bit location…

  8. Paul Murray says:

    Odd-Magne Kristoffersen :
    Yes, HP has modified the warranty lookup page. I’m working on a new script/solution for this now. 95% finished just some testing left. I’ll try and post an updated version this weekend.

    Have you updated the HP warranty lookup script?

  9. Costa says:

    I can’t thank you enough for both of this scripts. They are an amazing help. I’m not sure if you ran into this on your testing, but i thought i should mention it .Some Lenovos have upgraded warranty, and the warranty date is different from the upgraded warranty date, so the data pulled from the website is the expired warranty. See link below.

    Besides that, the other problem i had was like the guy above (Andrew Morris) and it turned out to be a bad date field ( it was set to dd-mm-yyyy), field was probably created because computer is outside of US. So i just modified the SQL query to ignore it.

    Thanks again for creating these.

  10. John Bryntze says:

    Thanks a lot for sharing this, it looks excellent, need this myself.

  11. Dayat Rambo says:

    There is one thing to be aware of before we begin. This process is dependent on the output from a Lenovo web site. If Lenovo updates the format of the output from the site, it could affect the processing of the data.

  12. […] Last year blogged about how to add Lenovo and HP warranty information to Configuration Manager 2012, you can find this blogpost here. […]

  13. Gerry says:

    Since the script is going to run on an end user machine as “SYSTEM”, i.e. with admin credentials, the script is unable to access the URL (at least where i work, there’s a proxy server in place). Have you ever considered this scenario?

    • Hi, yes that is true. At one place I configured this as an internal web-service running on a server with access to the internet and then the client systems queried this internal web-service to get the data. So that could be a solution. You could also include a proxy user in the script, but this again means that the username/password is directly visible in the script and most likely nothing you would like to do.

      I’ll see if I get the time in the near future to do a posting about the Web-Service solution.

      • Nick says:

        I’d be greatly interested in the Web Service solution. The environment I work in uses an Ironport solution which requires authentication to access the internet.

  14. Buddy says:

    Lenovo has changed their website, so it doesn’t work anymore.
    I could find no vbs solution for it so I decided to insert a vbs generated powershell script to capture it.

    For what it’s worth, my Lenovo code section:

    ‘// Define and call the web site

    ‘MACHINETYPE = sProductNumber SERIALNUMBER = sSerialNumber MACHINE DESCRIPTION = sProductVersion

    AbsPath = Replace(WScript.ScriptFullName, WScript.ScriptName, “”)
    if right(abspath,1) = “\” then AbsPath = left(AbsPath, len(AbsPath)-1)

    Set LENOVOPSSCRIPT = fso.CreateTextFile(AbsPath & “\lwl.ps1”, True, True)
    LENOVOPSSCRIPT.WriteLine (“$test = Invoke-WebRequest -uri -SessionVariable ln”)
    LENOVOPSSCRIPT.WriteLine (“$form = $test.forms[0]”)
    LENOVOPSSCRIPT.WriteLine (“$serial = ‘” & sSerialNumber & “‘”)
    LENOVOPSSCRIPT.WriteLine (“$form.Fields[” & chr(34) & “serialCode” & chr(34) & “]=” & chr(34) & “$($serial)” & chr(34))
    LENOVOPSSCRIPT.WriteLine (“$answer = Invoke-WebRequest -Uri (” & chr(34) & “” & chr(34) & ” + $form.Action) -WebSession $ln -Method $form.Method -Body $form.Fields”)
    LENOVOPSSCRIPT.WriteLine (“$a = $answer.ParsedHtml.getElementById(” & chr(34) & “warranty_result_div” & chr(34) & “).outerText”)
    LENOVOPSSCRIPT.WriteLine (“$LWENDDATE = $a.Substring(39,10)”)
    ‘LENOVOPSSCRIPT.WriteLine (“[Environment]::SetEnvironmentVariable(” & chr(34) & “LWENDDATE” & chr(34) & “, $LWENDDATE, ” & chr(34) & “Machine” & chr(34) & “)”)
    LENOVOPSSCRIPT.WriteLine (“$AbsPath = Split-Path -parent $MyInvocation.MyCommand.Definition”)
    LENOVOPSSCRIPT.WriteLine (“$LWENDDATE | out-file $AbsPath\lwenddate.txt -encoding ascii”)
    LENOVOPSSCRIPT.Close“powershell -executionpolicy bypass -windowstyle hidden -file ” & AbsPath & “\lwl.ps1”)
    while not fso.FileExists(AbsPath & “\lwenddate.txt”)
    wscript.sleep 2000
    Set LWENDDATE = fso.openTextFile(AbsPath & “\lwenddate.txt”, 1)
    arrLWENDDATE = Split(sLWENDDATE, “-“)
    const HKLM = &H80000002
    Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv”)
    sKeyPath = “SOFTWARE\Intel\LANDesk\Inventory\Custom Fields”
    oReg.CreateKey HKLM,sKeyPath
    oReg.SetStringValue HKLM, sKeyPath, “Vendor”, sProductVendor
    oReg.SetStringValue HKLM, sKeyPath, “ProductName”, sProductVersion
    oReg.SetStringValue HKLM, sKeyPath, “ProductNumber”, sProductNumber
    oReg.SetStringValue HKLM, sKeyPath, “ExpirationDate”, arrLWENDDATE(1) & “/” & arrLWENDDATE(2) & “/” & arrLWENDDATE(0)
    if fso.FileExists(AbsPath & “\lwenddate.txt”) then fso.DeleteFile AbsPath & “\lwenddate.txt”
    if fso.FileExists(AbsPath & “\lwl.ps1”) then fso.DeleteFile AbsPath & “\lwl.ps1”
    End Sub

    • baatch says:

      Buddy! I tried to run your updated Lenovo script, but it is not working. Maybe copying and pasting from website is a problem. Can you share the script through mail or other upload?

  15. funkyboogaloo says:

    Hi, links to the scripts appear to broken, please could you repost? The HP one would be extremely useful if it’s still able to pull from the site. Thanks 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s