HP and Lenovo Warranty Information in Configuration Manager 2012 R2

Posted: April 24, 2014 in Configuration Manager, System Center Configuration Manager 2012
Tags: , ,

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

Since that HP have changed their warranty lookup website so the script in the previous blogpost has stopped working. Yes the script solution is dependent on the output from the webpage to provide the information, so if the webpage change, the script most likely will stop to function again. But I’ve rewritten the scripts to make it easier to adjust if this happens.

You can download the updated scripts here; HP Lenovo – Dell

To implement this solution you can follow the steps below.

  1. You need to change the sCompanyName variable in the scripts to what you want, in the screenshot below I’ve changed it to ThinkIT Solution that is my lab “company”. You also have the option to disabel logging.
    1

We then need to create a .MOF file so we can configure Configuration Manager 2012 R2 to collect the warranty information through Hardware Inventory.

  1. First you’ll need to download Mark Cochrane’s RegKeytoMof 3.1 from here and run it on a computer where you have already executed the script file. Then you’ll need to locate the registry keys you want to inventory as shown in the screenshot below;
    2
  2. Browse to the following folder <Configuration Manager Install Directory>\inboxes\clifiles.src\hinv and make a copy of the configuration.mof file.
    20
  3. Open the configuration.mof file and browse to the end of the file and look for the following content
     //========================
     // Added extensions start
     //========================
    
     //========================
     // Added extensions end
     //========================

    Copy and paste the content from the configuration.mof tab between the Added extensions start and Added extensions end and save the configuration.mof file.9

  4. Select the “to import in Admin/Agent settings…” tab of the tool and copy the content and paste into a Notepad file that you save with a .mof extention.
  5. Open the Configuration Manager Console -> Administration Workspace -> Client Settings and open Default Client Settings.3Select Hardware Inventory and click on Set Classes4Click on Import.. and select the .mof file created in step 4. You’ll then be presented with the Import Summary Screen where you click on Import6
  6. By default the imported class will be selected and since this is the Default Client Settings it will apply to all systems if that is fine for your environment just click OK. But in this guide we’ll de-select it and at it just for the Custom Client Settings, do I de-select it and click OK twice.7
  7. I then open the the THI – Custom Client Device Settings that applies to the clients I would like to inventory the Warranty Information from select the Hardware Inventory and click on Set Classes. Here you can scroll down to or search for Warranty and select it and click on OK twice.8

So we have now configured Configuration Manager 2012 R2 to collect the Warranty Information, we now need to run the Warranty scripts on the clients, this can be done as an application or a package for existing systems that are already deployed or we can do it in the Task Sequence so all systems runs the script when they are deployed. I’m gonna walk you throug the process of setting this up in a Task Sequence in this post.

  1. First we need to create a package that holds the warranty check scripts. Go to the Software Library workspace and expand Application Management, right click Packages and select Create Package and the Create Package and Program Wizard will start. Fill out the information on the first screen as shown below and click next. (The source folder contains just the 2 vbscript files, HP.vbs and Lenovo.vbs)10
  2. On the Program Type pane select Do not create a program and finish the wizard.11
  3. Distribute the package to your Distribution Points.
  4. Open your Task Sequence and create a Group called Warranty Check.
  5. Add a new Run Command Line Step and give it a name, I’ve used HP – Set Warranty Information. In the command line section type in cscript.exe HP.vbs and select the Package we created in step 1. You should have something like the screenshot below;12
  6. Click on the Options tab and click on Add Condition and select Query WMI and paste in the following WQL Query: SELECT * FROM Win32_ComputerSystem WHERE Model LIKE “%HP%” (This will make sure that this step only runs on HP systems)13
  7. Add a new Run Command Line Step to the Warranty Check group and give it a name, Lenovo – Set Warranty Information. In the command line section type in cscript.exe Lenovo.vbs and select the Package we created in step 1. You should have something like the screenshot below;14
  8. Click on the Options tab and click on Add Condition and select Query WMI and paste in the following WQL Query: SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE “LENOVO” (This will make sure that this step only runs on Lenovo systems)15

When we deploy a new system now it will run the warranty check as part of the OSD process, and when the OSD process is complete we can find the following information on the client;

In registry:16

In C:\Windows\Temp\WarrantyInfo.log :17

And after Hardware Inventory process has completed on the client we can see the following from the Resource Explorer inside the Configuration Manager console:18

All information is also stored in a SQL View in the Configuration Manager Database so you can create reports from this information: (You can find an example query for a report in my previous posting)19

Any feedback is appreciated so feel free to leave a comment 🙂

Update 1
There has been several request for a simillar solutions for Dell computers, so one can cover all systems with the same script solution. So today I’ve made available a warranty script for Dell computers also. That you can download here; Dell. As always feedback is appreciated.

Comments
  1. Paul M says:

    I’ve tried the HP.vbs script and get an error;
    HP.vbs(140, 2) Microsoft VBScript runtime error: Subscript out of range: ‘[number: 1]’

    Just tested on my HP laptop to check the log and registry entries before modifying the MOF etc…

    • Hi Paul,

      I’ve tested the script on 7 different HP models and several computers of each model with no issues. Could be that you get a different output on the webpage. (Do you know if there are added some extra warranty options to the computer you are testing on.)

      If you want to share the the ProductNumber and Serial with me I can take a look at your case and make the adjustments needed for it to function properly. (You can send me a DM on twitter with the information if you want @oddmk79)

  2. Paul Murray says:

    Hello Odd-Magne,

    Sorry for the late response;

    HP EliteBook 8570w
    5CB3160VDB

    Thanks

  3. Paul Murray says:

    Hello Odd-Magne,

    Yes I have a internet connection and able to access the warranty information page URL you provided. However in the warrantyinfo.log I notice the URL is slightly different when I run the script.

    *********************************************************
    5/5/2014 8:05:35 AM Beginning warranty information lookup.
    5/5/2014 8:05:35 AM Serial number of system is 5CB3160VDB
    5/5/2014 8:05:36 AM Product number of the system is C3Z12EC#ABA
    5/5/2014 8:05:36 AM Operating system is 64 bit.
    5/5/2014 8:05:36 AM Opening the web site URL http://h10025.www1.hp.com/ewfrf/wc/weResults?lc=en&dlc=en&cc=th&tmp_weCountry=us&tmp_weSerial=5CB3160VDB&tmp_weProduct=C3Z12EC#ABA
    5/5/2014 8:05:39 AM Successful response from the web site.
    5/5/2014 8:05:39 AM Processing the HTML returned from the site.
    5/5/2014 8:05:39 AM Registry key path is HKLM\SOFTWARE\CompanyName\WarrantyInformation
    5/5/2014 8:05:39 AM Setting registry values.
    *********************************************************

    Difference is; weProduct=C3Z12EC#ABA

    Error;
    hp.vbs(140, 2) Microsoft VBScript runtime error: Subscript out of range: ‘[number: 1]’

  4. Paul Murray says:

    Well I tried the manual process and it didn’t return any warranty data with the serial and product numbers. I then tried the “Automatic product detection and warranty check” it found the serial and product numbers, I click check warranty status and again nothing.

    wierd…. So it’s definitely not the script in the situation.

    So I see on the page;

    HP Products that cannot be automatically detected
    The following product categories can not be detected:

    Digital cameras
    non-Ipaq Handhelds/Smartphones
    Calculators
    Keyboards, accessories, and options
    Monitors and flat panels
    Printer supplies
    Servers
    Software
    Storage
    Workstations <– I have a workstation

    • Gonçalo says:

      Hi, I’m getting this error in report:
      Conversion failed when converting date and/or time from character string..

      Can you help me?

      Thanks

  5. Gary Smith says:

    I have used these scripts in the past and never know where they came from. I just wanted to say thanks for making the available!

  6. david says:

    How do you push this as a command to existing machines? When i create a package and push to the clients, SCCM reports success, but when checking the client, the registry entries are not written and there is no log file.

    • Cory Freeman says:

      I am also having this issue when I push this out as a Package or even during task sequence it is running but getting the following error:

      *********************************************************
      8/26/2014 5:01:57 PM Beginning warranty information lookup.
      8/26/2014 5:01:57 PM Serial number of system is XXXXXXXX
      8/26/2014 5:01:57 PM Operating system is 32 bit.
      8/26/2014 5:01:57 PM Opening the web site URL https://api.dell.com/support/v2/assetinfo/warranty/tags.xml?svctags=XXXXXXXX&apikey=1adecee8a60444738f280aad1cd87d0e
      8/26/2014 5:02:22 PM ERROR: the web site returned status code System error: -2146697191.

      8/26/2014 5:02:22 PM Returning exit code 1.
      *********************************************************

      But if I run the script myself it runs fine everytime.

      Thoughts?

  7. Branden long says:

    I’ve been trying to get your Warranty Info scrape working, but nothing ever shows up in SCCM or SQL Server. I can look on the clients and see the vbscript ran, created WarrantyInfo.log and registry entries, but when the hardware inventory runs, it never makes it into SCCM (as far as I can tell).

    InventoryAgent.log has some failures, but it doesn’t say what specific hardware classes failed. How do I go about debugging this?

  8. Branden Long says:

    I drilled down into the InventoryAgent.log for one of the machines and discovered this line:

    Collection: Class “WarrantyInformation” does not exist.

    What does this mean? What did I miss?

  9. Jonathan says:

    Anyone know why I get the following error when running the hp.vbs script:

    —————————
    Windows Script Host
    —————————
    Script: C:\HP.vbs
    Line: 67
    Char: 1
    Error: 0x8004100C
    Code: 8004100C
    Source: (null)

    —————————
    OK
    —————————

  10. KK says:

    This is really nice 🙂 But do You have a vbs for Intel NUC computers???

  11. Travis says:

    Any way to get this written so the output is put into a CSV instead of the registry? I’d love to be able to pull warranty info en masse without doing it through SCCM.

  12. baatch says:

    Is it possible to change the date format to YYYY-MM-DD ?

  13. Anders Hedberg says:

    Dell script creates “Expiration Date”, HP script creates “ExpirationDate”

  14. Brandon W says:

    Im running into Microsoft VBScript runtime error: Subscript out of range: ‘[number: 1]’ line 128 character 2. on the lenovo script. This occurs even if im running it manually VS as a package.

    according to notepad this is the line affected:
    SerialNumber = split(xmlhttp.responseText,”Serial number:”)(1)

    I am unable to determine what is wrong.

  15. Chris says:

    Thank You for the script, and working well with SCCM. However, what I didn’t realise until after I deployed the script via SCCM, the reg keys get written to Wow6432Node rather than HKLM\Software if ran manually. No big deal, just had to edit the output of RegKeytoMOF in configuration.mof.

    The real issue for me, I’ve deployed the vb script via SCCM as a package and a lot of the devices get to opening the website URL and stop there, not all but certainly the majority. They do have an Internet connection. Should I be running this with user rights or admin rights? Any ideas?

    Thank You,

  16. Jesper says:

    Lenovo seems to have changed their website to csp.lenovo.com, Also it seems to fail to parse the result for newer machines with the longer model numbers?

  17. Buddy Bishop says:

    It appears that Lenovo has changed the lookup process to require an manual input to a manual CSV upload. Manual. UGGHH!!

  18. Buddy Bishop says:

    I meant to type:
    It appears that Lenovo has changed the lookup process to require a manual input OR a manual CSV upload. Manual. UGGHH!!

  19. Buddy Bishop says:

    I found this after searching:

    It’s powershell and I’d like to get or figure out how to write a vbs version too.

    $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

    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/76d24b85-7ce3-497c-973e-beece6c68ed3/get-lenovo-warranty-info-automatically?forum=winserverpowershell

  20. David C. Hyatt says:

    The lenovo script no longer works. It fails with internal server error 500, i’m guessing that lenovo don’t want us to use it. So i did a rewrite of the script to powershell and got it working. If you are interested, I can share here.

  21. Kjell Sundling says:

    To have Dell warranty script running again change to the following in script:
    sParameters = “&apikey=849e027f476027a394edd656eaef4842”

  22. David says:

    Error:
    Dell.vbs(81, 1) msxml3.dll: Access is denied.

    The only thing I changed was the company name so far.

  23. Nick says:

    HP script works, it just is not writing to the registry. I can tell its working through the log file… Not sure why it wont write, I’m running as local admin…

  24. Andrew Usher says:

    I continue to run into errors with the VBscript not able to pull the Product Number. Happening with both new and old machines. Any thoughts?

    • Anderz says:

      Hi,

      I’m having the same issue, seems the address in the script isn’t working any more…any thoughts on the new link?

  25. Arturo says:

    Please the script no respond for website maybe the the web page its update??

  26. Anderz says:

    HI,

    Seems like HP changed the link. Any idea on how to retrieve the new link?

  27. Anderz Wedefelt says:

    Hi,

    It seems the HP link has changed, at least it gets stuck for us at the moment, any way to find the “new” link?

    TIA

    Anderz

  28. Anderz says:

    Hi,

    It seems that the link for HP might have changed, any suggestions on retrieving the new link?

    TIA

  29. Roland says:

    Hey,

    looks like as if HP changed something?
    The url I’m getting sends me now to http://support.hp.com/us-en

    Will you be able to fix it?

    regards, Roland

  30. Roland says:

    Hi,

    you have feedback on my feedback? 🙂

    cheers, roland

  31. patrick says:

    Hi,
    It looks lik HP changed their warranty URL.
    Can you check please?

  32. Matthew Russo says:

    The download links no longer work in this post.

  33. Sudarsan says:

    Scripts link is broken, could you please re upload the Scripts

  34. s0mm3r says:

    new script for latest HP page changes 24.05.2016
    http://s000.tinyupload.com/download.php?file_id=35787357943660528901

  35. s0mm3r says:

    Don’t know if the first post worked
    new script for latest HP page changes 24.05.2016
    regards
    http://s000.tinyupload.com/download.php?file_id=35787357943660528901

  36. s0mm3r says:

    new script for latest HP page changes
    regards
    http://s000.tinyupload.com/?file_id=35787357943660528901

  37. Jason Ross says:

    Your link to your Powershell scripts are now dead. Can you repost your Powershell scripts? Thank You.

  38. Vinod says:

    Hi, the link to download the script is failing.

  39. Cory says:

    Download Lenovo script is broken

  40. simon says:

    the “You can download the updated scripts here; HP – Lenovo – Dell” Lenovo link does not work – OneDrive – file no longer exists

  41. s0mm3r says:

    Script for non Enterprise Products:
    https://www.dropbox.com/s/svug453jxcq7ryi/hp.vbs?dl=0
    regards

  42. Underi says:

    Thanks s0mm3r!

  43. Cory says:

    Anyone have this working for Lenovo?

  44. Aavoxx says:

    Do you have an updated Dell script, by chance?

  45. Chris says:

    Hi,

    Would you still have the powershell script for Lenovo?

    It is no longer available on OneDrive….

    Thanks in advance

  46. Ansi says:

    Is this still working?
    Wasn’t sure if Hp adding the captcha would break it.

  47. MohamedShaik says:

    please share the lenovo & Dell script download link

  48. francesco pandiscia says:

    anyone have script to share?
    Download onedrive site is broken

  49. MohamedShaik says:

    need your help, please share the download link for Lenovo & Dell warranty information script

  50. Andrew D says:

    Hi! Has anyone managed to update the HP script for non-Enterprise products? I’ve got a decent working URL, but I’m struggling with the section that parses the response and gives the warranty end date.

  51. John Marcum says:

    Does anyone have currently working scripts for any or all of the 3 major brands?

  52. mart says:

    Hello 🙂
    Great article! Any chances please to update the links to scripts please? All are gone 😐
    Thank you!
    Best regards,
    m.

  53. […] HP and Lenovo Warranty Information in Configuration Manager 2012 R2 […]

Leave a comment

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