• About me…
  • VMware
  • Powershell
  • DIY

ConfigMgr.nl

VMware, PowerShell, Automation, and more…

  • About me…
  • VMware
  • Powershell
  • DIY

Powershell – looking up HP warranty information

8 mei 2017 Powershell Script No Comments

Today I wanted to get an overview of the warranty information of our ESX hosts. All the hosts are added to a HP Insight Remote Support server so the warranty information is available. However, using this information from powershell is a bit more challenging.

Fortunately I found a powershell module named HPWarranty. Could this be the solution?

First, install the PowerShellGet module. Details about the installation can be found here. Personally, I installed the MSI installer.

Second, start a new Powershell session and type Install-Module -Name HPWarranty. You will get a warning to install the NuGet provider 2.8.5.201. Select Yes. The installation will pull some files from an untrusted repository so you will get a second warning about that. I selected Yes. The module is now installed.

To try it out I entered the following command:
Get-HPEntWarrantyEntitlement -ProductNumber 654081-B21 -SerialNumber CZ3434BB9K

For some reason it asked me for credentials but after escaping out I got this output:

So the next question might be: how can I retrieve the product number and serial number? For this I wrote a powershell function that utilizes anonymous access to iLO:

[code language=”powershell”]
Function Get-HPWarrantyInfo {

<# .SYNOPSIS Get HP warranty information from server .DESCRIPTION Use this script if you need to get warranty information .PARAMETER ComputerName Remote server name .EXAMPLE .\Get-HPWarrantyInfo.ps1 -ComputerName server1 Get the warranty information of the server server1 .NOTES Script name: Get-HPWarrantyInfo.ps1 Author: Jeroen Buren DateCreated: 08-05-2017 #>

[CmdletBinding(SupportsShouldProcess=$true)]

param(
[parameter(ValueFromPipeLine=$True,ValueFromPipeLineByPropertyName=$True)]
[string[]]$ComputerName = $env:COMPUTERNAME
)

Begin {
$ErrorActionPreference = ‘SilentlyContinue’
$ComputerCount = $ComputerName.Count
}

Process {
$outputobject = @()
Foreach ($Computer in $ComputerName) {
$ProgressCount++
Write-Progress -Activity "Getting warranty information…" -Id 1 -Status "$($ProgressCount) / $($ComputerCount)" -CurrentOperation "$Computer" -PercentComplete (($ProgressCount / $ComputerCount) * 100)
If (Test-Connection -ComputerName $Computer -Count 1 -Quiet) {
$XML = New-Object XML
#Retrieving iLO hardware information
$XML.Load("http://$Computer/xmldata?item=All")
If ($?) {
$object = New-Object PSObject -Property @{
Computername = $Computer
SerialNumber = $($XML.RIMP.HSI.SBSN)
ProductName = $($XML.RIMP.HSI.SPN)
SKU = $($XML.RIMP.HSI.PRODUCTID) -replace " ",""
WarrantyEndDate = $(Get-HPEntWarrantyEntitlement -ProductNumber $($XML.RIMP.HSI.PRODUCTID) -SerialNumber $($XML.RIMP.HSI.SBSN)).OverallEntitlementEndDate
}
$outputobject += $object
}
}
}
$outputobject.pstypenames.insert(0,’Hardware.Info’)
$outputobject | ft
}
}
[/code]

The script is inspired from this page.

Restoring Task Sequences the easy way

Powershell - looking up HP warranty information - part 2

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.