• About me…
  • VMware
  • Powershell
  • DIY

ConfigMgr.nl

VMware, PowerShell, Automation, and more…

  • About me…
  • VMware
  • Powershell
  • DIY

Powershell – looking up HP warranty information – part 2

13 mei 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:

[code language=”powershell”]
[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
}
[/code]

To this:

[code language=”powershell”]
[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
}
[/code]

Powershell - looking up HP warranty information

Upgrading to SCCM 1702

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

  1. menno
    3 november 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?

    Beantwoorden
    • Jeroen Buren
      3 november 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”.

      Beantwoorden
Geef een antwoord Reactie annuleren

Deze website gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.

Recente berichten

  • Handy one-liners
  • The system has insufficient locker space for the image profile
  • Testing Script Runtime Service for vSphere – part 2
  • Reporting on your Windows Server backup
  • Testing Script Runtime Service for vSphere – part 1

Jeroen BurenFollow

Jeroen Buren
jeroen_burenJeroen Buren@jeroen_buren·
21 jun

Never stop learning... https://dy.si/bJt42

Reply on Twitter 1539159798926610432Retweet on Twitter 1539159798926610432Like on Twitter 1539159798926610432Twitter 1539159798926610432
Retweet on TwitterJeroen Buren Retweeted
brianmaddenBrian Madden@brianmadden·
26 mei

I just wrote an article on LinkedIn with my brutal and honest thoughts on the @Broadcom / @VMware deal. VMware is toast. It's sad, but there is no other way. https://www.linkedin.com/pulse/brian-maddens-brutal-unfiltered-thoughts-broadcom-vmware-brian-madden/

Reply on Twitter 1529925814203973632Retweet on Twitter 152992581420397363294Like on Twitter 1529925814203973632388Twitter 1529925814203973632
jeroen_burenJeroen Buren@jeroen_buren·
25 mei

A video tells more than a thousand words... https://dy.si/DBFdUR2

Reply on Twitter 1529336584557867010Retweet on Twitter 1529336584557867010Like on Twitter 1529336584557867010Twitter 1529336584557867010
jeroen_burenJeroen Buren@jeroen_buren·
1 mei

Fijn weer een seintje gekregen van @VattenfallNL : Uw termijnbedrag is op dit moment niet meer helemaal in lijn met uw verbruik. Ze bedoelen natuurlijk niet meer in lijn met hun tarieven…

Reply on Twitter 1520835622042222595Retweet on Twitter 1520835622042222595Like on Twitter 15208356220422225952Twitter 1520835622042222595
jeroen_burenJeroen Buren@jeroen_buren·
13 dec

Baas!! Was geweldig om te zien

Ziggo Sport Racing@ZS_Racing

De legendarische @SChecoPerez aan het woord! 🙌

'Ik was aan het einde van mijn leven, ik was aan het doodgaan. Maar Lewis Hamilton verloor een aantal seconden', aldus Sergio Pérez tegenover @JackOnTracks 📽️

#ZiggoSport #F1 #AbuDhabiGP 🇦🇪

Reply on Twitter 1470285708338335747Retweet on Twitter 1470285708338335747Like on Twitter 1470285708338335747Twitter 1470285708338335747
Load More...

Categorieën

Proudly powered by WordPress | Theme: Doo by ThemeVS.