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
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!
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.
Creating the custom data class
- In the SMP console, open Settings -> All Settings
- Drill down to Discovery and Inventory -> Inventory Solution -> Manage Custom Data Classes
- Click the New Data Class button and name the data class "HP Warranty Information"
- 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 - 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
- Write down or copy the guid of the data class into Notepad, as you'll need this later in the script
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!
- In the SMP console, go to Manage -> Jobs and Tasks
- Right-click Jobs and Tasks and choose New -> Task
- Scroll down and click the Run Script task
- In the task title (currently "Run Script"), change the name to "Gather HP Warranty Information" or similar
- Change the Script Type to VBScript
- Paste your script with the correct guid into the script window
- Click the Advanced button
- In the "Other" section, change Show Script to Hidden
- Click OK twice to save the new task
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.
No comments:
Post a Comment