ConfigMgr

VMware, Azure and Automation

Powershell – looking up HP warranty information

8 mei 2017 Powershell Script

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

Recent Posts

  • Using API for Aria OPS Chargeback
  • Unable to set reservation on Org VDC
  • Veeam Tweaks
  • VCF Anyone? Get your license for free…
  • Configure Entra ID as Cloud Director IdP

Recent Comments

Geen reacties om te tonen.

Archives

  • april 2025
  • maart 2025
  • november 2024
  • oktober 2024
  • januari 2024
  • november 2023
  • oktober 2023
  • september 2023
  • juni 2023
  • mei 2023
  • april 2023
  • november 2022
  • maart 2021
  • februari 2021
  • januari 2021
  • november 2020
  • oktober 2020
  • september 2020
  • juli 2020
  • juni 2020
  • april 2020
  • maart 2020
  • februari 2020
  • oktober 2019
  • september 2019
  • juli 2019
  • juni 2019
  • mei 2019
  • maart 2019
  • februari 2019
  • januari 2019
  • december 2018
  • november 2018
  • april 2018
  • januari 2018
  • juli 2017
  • juni 2017
  • mei 2017

Categories

  • AnyLinq
  • Azure
  • Cloud Director
  • ConfigMgr
  • DIY
  • HomeAssistant
  • Microsoft
  • PowerCli
  • Powershell
  • SCCM
  • Script
  • Solutions
  • System Center
  • Veeam
  • VMware
  • vRealize Automation
  • vRealize Orchestrator
Proudly powered by WordPress | Theme: Doo by ThemeVS.