• About me…

ConfigMgr.nl

VMware, Automation and more

  • About me…

Powershell – looking up HP warranty information – part 2

13-05-2017 Powershell Script 2 Comments

Earlier I published a post about retrieving warranty information for HP hardware. However, the end date that is returned by the script might not always be correct!

Let me explain…

What the script does is executing a SOAP request to a website. The outcome of that request is XML data and the script returns three specific parameters:

  • ActiveEntitlement (true or false)
  • OverallEntitlementStartDate
  • OverallEntitlementEndDate

So let’s look at the outcome for a random server:

Based on the returned information warranty ends on 31-08-2017. But is that true? If I enter the same information on the HP support site I get the following data:

It looks like the powershell cmdlet returns the end date of the base warranty. But for this server a seperate support agreement is active and the actual warranty end date is 30-09-2019. So let’s see if this info is available is the returned XML data…

It is! The parameter OverallContractEndDate has the correct warranty end date. Returning this extra info is very easy. Just add one single line of code to the powershell script Get-HPEntWarrantyEntitlement.ps1. Default location is C:\Program Files\WindowsPowerShell\Modules\HPWarranty\2.6.2\Public.

Change this:

[HashTable]$output = @{
'SerialNumber' = $SerialNumber
'ProductNumber' = $ProductNumber
'ActiveEntitlement' = $entitlement.'ISEE-GetOOSEntitlementInfoResponse'.Data.EsReply.CombinedUnitEntitlement.ActiveWarrantyEntitlement
'OverallEntitlementStartDate' = $entitlement.'ISEE-GetOOSEntitlementInfoResponse'.Data.EsReply.CombinedUnitEntitlement.OverallWarrantyStartDate
'OverallEntitlementEndDate' = $entitlement.'ISEE-GetOOSEntitlementInfoResponse'.Data.EsReply.CombinedUnitEntitlement.OverallWarrantyEndDate
}

To this:

[HashTable]$output = @{
'SerialNumber' = $SerialNumber
'ProductNumber' = $ProductNumber
'ActiveEntitlement' = $entitlement.'ISEE-GetOOSEntitlementInfoResponse'.Data.EsReply.CombinedUnitEntitlement.ActiveWarrantyEntitlement
'OverallEntitlementStartDate' = $entitlement.'ISEE-GetOOSEntitlementInfoResponse'.Data.EsReply.CombinedUnitEntitlement.OverallWarrantyStartDate
'OverallEntitlementEndDate' = $entitlement.'ISEE-GetOOSEntitlementInfoResponse'.Data.EsReply.CombinedUnitEntitlement.OverallWarrantyEndDate
'OverallContractEndDate' = $entitlement.'ISEE-GetOOSEntitlementInfoResponse'.Data.EsReply.CombinedUnitEntitlement.OverallContractEndDate
}

Powershell - looking up HP warranty information

Upgrading to SCCM 1702

2 thoughts on “Powershell – looking up HP warranty information – part 2”

  1. menno
    03-11-2017 at 16:44

    It works fine
    little question
    when i use Import-Csv c:\import.csv | Get-HPIncWarrantyEntitlement i get the inforation in powershell
    but when i use Import-Csv c:\import.csv | Get-HPEntWarrantyEntitlement | Export-Csv c:\export.csv i get this message in the export.csv

    #TYPE System.Collections.Hashtable
    “IsReadOnly”,”IsFixedSize”,”IsSynchronized”,”Keys”,”Values”,”SyncRoot”,”Count”
    “False”,”False”,”False”,”System.Collections.Hashtable+KeyCollection”,”System.Collections.Hashtable+ValueCollection”,”System.Object”,”5″
    do you know how i can fix this?

    Reply
    • Jeroen Buren
      03-11-2017 at 20:44

      Hi Menno,

      The problem is caused by the output itself. It’s a hashtable… To overcome this, there are several options. Search the web for “export.csv returns system.object”.

      Reply
Leave a Reply Cancel reply

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

Recent Posts

  • Reporting on your Windows Server backup
  • Testing Script Runtime Service for vSphere – part 1
  • Using ADFS with vCenter 7
  • Network Port Diagram vSphere
  • Joining ESXi hosts to AD using Authentication Proxy in vCenter 7 (updated 04-12-2020)
  • Windows Server 2019 customization issue
  • Packer and WinRM – mystery resolved
  • Using LDAPS with vCenter and AD
  • Backup your homelab… for free!
  • Remediation did not succeed

Archives

Categories

AnyLinq (1) Azure (2) ConfigMgr (8) DIY (4) PowerCli (8) Powershell (9) SCCM (9) Script (12) Solutions (16) System Center (3) VMware (30) vRealize Automation (1) vRealize Orchestrator (1)

Jeroen BurenFollow

Jeroen Buren
Retweet on TwitterJeroen Buren Retweeted
Annemiek73Annemiek Meijer@Annemiek73·
16 Jan

Running man kan altijd! Ook tijdens #VVAL2021 @VriendvanAmstel #RunningMan #VVALS

Reply on Twitter 1350537030879608833Retweet on Twitter 13505370308796088332Like on Twitter 135053703087960883327Twitter 1350537030879608833
Retweet on TwitterJeroen Buren Retweeted
PowerCLIVMware PowerCLI@PowerCLI·
11 Jan

Do check out the SRS roadmap here. Feel free to influence the roadmap by submitting your requests. https://github.com/vmware/script-runtime-service-for-vsphere/projects/2 https://twitter.com/PowerCLI/status/1337370157551796225

VMware PowerCLI@PowerCLI

Introduction to Script Runtime Service (SRS) for vSphere https://blogs.vmware.com/PowerCLI/2020/12/introduction-to-script-runtime-service-srs-for-vsphere.html

Reply on Twitter 1348606798492618752Retweet on Twitter 13486067984926187524Like on Twitter 13486067984926187528Twitter 1348606798492618752
jeroen_burenJeroen Buren@jeroen_buren·
7 Jan

New blogpost about Script Runtime Service for vSphere.
https://configmgr.nl/2021/01/07/testing-script-runtime-service-for-vsphere-part-1/

#VMware #vSphere #SRS #PowerCLI

Reply on Twitter 1347191971002118144Retweet on Twitter 1347191971002118144Like on Twitter 1347191971002118144Twitter 1347191971002118144
jeroen_burenJeroen Buren@jeroen_buren·
18 Dec

Nice!! https://www.formula1.com/en/latest/article.breaking-perez-to-partner-verstappen-at-red-bull-in-2021-as-albon-becomes.21qHfmHAyfzAjVHT3PfVBd.html

Reply on Twitter 1339935240069001218Retweet on Twitter 1339935240069001218Like on Twitter 13399352400690012181Twitter 1339935240069001218
Retweet on TwitterJeroen Buren Retweeted
vRealizeAutovRealize Automation@vRealizeAuto·
16 Dec

#vRA x Terraform part 1 — #Cloud Automation Essentials☁️

Check out this blog to explore how you can use vRealize Automation and Terraform in effective ways.👍 https://bit.ly/3r2sLxE

Reply on Twitter 1339261564931727368Retweet on Twitter 13392615649317273686Like on Twitter 13392615649317273685Twitter 1339261564931727368
Load More...
Proudly powered by WordPress | Theme: Doo by ThemeVS.