Video Screencast Help

How to Get HP Inventory Information Into the SMP 7.1 Database

Created: 21 Sep 2012 • Updated: 21 Sep 2012 | 7 comments
Language Translations
dfrancis's picture
+4 4 Votes
Login to vote

This will be useful to any HP shops out there.  This article explains how to set up a custom data class and script to gather warranty information from HP computers and record this information into the CMDB.  The vbscript obtains the machine's product number and serial number via WMI calls, passes this information to HP's warranty check website, and parses the resulting HTML to get warranty details.  To accomplish this, we need to first define a custom data class in the CMDB, then create the task to be run on your machines.

Creating the custom data class

  1. In the SMP console, open Settings -> All Settings
  2. Drill down to Discovery and Inventory -> Inventory Solution -> Manage Custom Data Classes
  3. Click the New Data Class button and name the data class "HP Warranty Information"
  4. Next, add the following attributes to the HP Warranty Information data class:
    Serial Number, Data Type = String, Size = 25, Key = No, Required = No
    Product Number, Data Type = String, Size = 25, Key = No, Required = No
    Line, Data Type = String, Size = 50, Key = No, Required = No
    Description, Data Type = String, Size = 50, Key = No, Required = No
    Date Updated, Data Type = Date, Size = 8, Key = No, Required = No
    Warranty Type, Data Type = String, Size = 50, Key = No, Required = No
    Warranty Start, Data Type = Date, Size = 8, Key = No, Required = No
    Warranty End, Data Type = Date, Size = 8, Key = No, Required = No
  5. Once all of the attributes have been created, click the "finger" button (next to New Data Class) to view the details for the data class
  6. Write down or copy the guid of the data class into Notepad, as you'll need this later in the script

At this point, you should see a new table in your CMDB, and it should be called "Inv_HP_Warranty_Information" -- you can verify this by opening SQL Server Management Studio, creating a new query against the Symantec_CMDB database of "select * from Inv_HP_Warranty_Information" and seeing 0 rows returned.  You can also go into Settings -> Notification Server -> Resource and Data Class Settings -> Data Classes -> Inventory -> Custom -> HP Warranty Information.  Opening the data class from this location will give you the guid as well as the table name, should you need either for future reference.

Most of the fields in this data class are self-explanatory.  The "Line" and "Description" fields are a little cryptic, though.  Line is a more generic description for the product line of the computer.  The description lumps together a lot of the details about the computer, such as processor, memory, and hard drive.

The attached text file is the vbscript you will use to create a task in the SMP.  You'll want to open this file up in a text editor and on line 7 replace xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with the guid from your data class you created above prior to pasting this into the SMP.

Once that is done, now would be a good time to do a reality check to make sure everything is working and run this vbscript manually on a managed computer to ensure the database is being populated properly.  To do this, you can save that edited file as a .vbs file on an Altiris-managed HP computer, i.e. hpwarranty.vbs, drop to a command prompt and run "cscript hpwarranty.vbs" -- when you run this, you should see no output from the script itself and be returned to the command prompt within a few seconds of running it.

Once this is done, you can either open SQL Server Management Studio and re-run the query mentioned above, or open Resource Manager on the computer record.  When you have Resource Manager open, go to View -> Inventory, then expand Data Classes -> Inventory -> Custom -> HP Warranty Information.

 If you see data here, then you're good to plow forward and create the inventory task!

  1. In the SMP console, go to Manage -> Jobs and Tasks
  2. Right-click Jobs and Tasks and choose New -> Task
  3. Scroll down and click the Run Script task
  4. In the task title (currently "Run Script"), change the name to "Gather HP Warranty Information" or similar
  5. Change the Script Type to VBScript
  6. Paste your script with the correct guid into the script window
  7. Click the Advanced button
  8. In the "Other" section, change Show Script to Hidden
  9. Click OK twice to save the new task

If you want to do one more reality check, do a Quick Run of the script on a different managed HP machine to validate that the task is running properly.  Again, you can go into SQL Server Management Studio or Resource Manager to validate the results.

Now that the task is created, you just need to create a schedule and a target that meets the needs of your organization.  As we only have HP workstations reporting into our SMP, I just targeted the Windows Computers filter and I was good to go, but for others who may have mixed environments, you may need to tweak your target to meet your needs.  With the data in the CMDB, you are now open to do things like create custom reports with this information.

To give credit where credit is due, the original vbscript was not created by me, but obtained from a blog related to getting this same information into SCCM.  I just heavily modified it to make it work with this implementation.  Provided HP doesn't make any big changes to their warranty site, this script should work but if they decide to change anything, this script will most likely stop working properly.

Comments 7 CommentsJump to latest comment

klefev's picture

This should be a very useful script. Nevertheless it doesn't work for me because of the used HP website:

http://h20000.www2.hp.com/bizsupport/TechSupport/WarrantyResults.jsp

Every lookup gives the following fault:

A connection to the Warranty Database could not be
established for this unit.

Please try again later. (null)

I do get my warranty information with an other Hp website:

http://www11.itrc.hp.com/service/ewarranty/warrantyResults.do

Any suggestions?

 

 

 

 

 

 

 

 

warrantylookup.JPG
0
Login to vote
dfrancis's picture

I'm seeing the same thing on a machine that was working the other day.  I'm thinking this may be an issue on their side that will hopefully be resolved soon -- I know I was having trouble submitting a warranty claim on a machine the other day and when I called them they mentioned they were having some system problems.

I'd recommend giving it a couple of days and trying again to see if the problem resolves itself.

You can manually check the warranty by replacing SERIALNUMBER and PRODUCTNUMBER in the below URL, which currently fails.

http://h20000.www2.hp.com/bizsupport/TechSupport/W...

--Dave

If a forum post solves your problem, please flag it as a solution. If you like an article, blog post or download vote it up.

0
Login to vote
markfreeman's picture

Yep, same here which is a real shame. Hopefully HP will get the site back up soon.

0
Login to vote
dfrancis's picture

Looks like HP's site finally started behaving itself again, for anyone who wants to try this out in their environment.

 

--Dave

If a forum post solves your problem, please flag it as a solution. If you like an article, blog post or download vote it up.

0
Login to vote
klefev's picture

I have implemented this and it's working fine. I just did some minor changes to the script:

1) Change of datatype for Warranty Start and Warranty End from date to string. Most of my pc's are located outside US, which means they aren't using the US region formats. The script uses CDate to convert the dates, which doesn't work for those pc's.

2)  I have added an extra warranty type called: "hwm onsite". The HP Care pack on our pc's gives this contract info instead of "wty hp hw maintenance onsite support".

3)  I had to change the Warrranty Type attribute to a string size 60 (50 is too short). Here I also had to add some code to trim all the spaces out of sWarrantyType. I then get a string: "HP Care Pack - Care Pack Serial Number XXXXXXXXXXXX".

It will be very userfull to have the information inside the SMP database.

 

Thanks!

 

+1
Login to vote
markfreeman's picture

Same issue here regarding the date format for non US regions. My vbscripting isn't up to reformating that but it would be good if someone could work out how. Having the dates in strings will make it harder for reporting going forwards.

0
Login to vote
Jamie Brown's picture

Hello.   I know this is an older post but I think HP is using a different warranty lookup site at http://h20566.www2.hp.com/portal/site/hpsc/public/wc/home instead of the one in the script.   Has anyone figured out how to get this new lookup site to work with the custom inventory option?

 

0
Login to vote