You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将Get-HPWarrantyEntitlement信息导出至自定义注册表并导入SCCM?

Solution to Capture HP Warranty Info to Registry for SCCM

I’ve worked through similar SCCM and HP device management tasks before, so here’s a tested, step-by-step workflow to make this happen:

Step 1: Install the Required HP PowerShell Module

First, you need the HPEScriptingTools module to run Get-HPWarrantyEntitlement. Fire up an elevated PowerShell session and run this:

# Install the module (accept prompts for repository access if needed)
Install-Module -Name HPEScriptingTools -Force -AllowClobber

If deploying this across multiple devices, add error handling to the script to skip installation if the module is already present.

Step 2: PowerShell Script to Fetch Warranty & Write to Registry

This script pulls key warranty details and writes them to a machine-wide registry path (SCCM prioritizes HKLM keys for inventory collection):

# Require elevated privileges to write to HKLM
#Requires -RunAsAdministrator

# Import HP module with error handling
try {
    Import-Module HPEScriptingTools -ErrorAction Stop
}
catch {
    Write-Error "HPEScriptingTools module missing. Install it first with Install-Module HPEScriptingTools."
    exit 1
}

# Retrieve warranty data (uses the device's serial number automatically)
try {
    $warranty = Get-HPWarrantyEntitlement -ErrorAction Stop
}
catch {
    Write-Error "Failed to fetch warranty info: $_"
    exit 1
}

# Create custom registry path if it doesn't exist
$registryPath = "HKLM:\Software\YourOrg\DeviceInventory\HPWarranty"
if (-not (Test-Path $registryPath)) {
    New-Item -Path $registryPath -Force | Out-Null
}

# Write critical warranty values to registry
Set-ItemProperty -Path $registryPath -Name "SerialNumber" -Value $warranty.SerialNumber -Type String
Set-ItemProperty -Path $registryPath -Name "WarrantyStatus" -Value $warranty.Status -Type String
Set-ItemProperty -Path $registryPath -Name "EndDate" -Value $warranty.EndDate.ToString("yyyy-MM-dd") -Type String
Set-ItemProperty -Path $registryPath -Name "ProductNumber" -Value $warranty.ProductNumber -Type String
Set-ItemProperty -Path $registryPath -Name "EntitlementType" -Value $warranty.EntitlementType -Type String

Write-Host "Warranty data saved to registry: $registryPath"

Adjust the $registryPath to match your organization’s naming standards, and add/remove properties based on which warranty details you need to collect.

Step 3: Configure SCCM to Collect the Registry Data

Once the registry values are on devices, set up SCCM hardware inventory to capture them:

  • Open the SCCM Console, go to Administration > Client Settings (use Default Client Settings or create a custom policy)
  • Edit the settings, navigate to Hardware Inventory > Set Classes
  • Click Add > Connect, select a device that already has the registry keys populated, then browse to your custom HKLM path
  • Import the registry values as a new inventory class (name it something like HP_Device_Warranty)
  • Deploy the updated client settings to your device collections, then trigger a hardware inventory cycle on target devices

Key Tips to Avoid Issues

  • Permissions: Deploy the script via SCCM Package/Program or Script Deployment with elevated rights (required to write to HKLM and install modules)
  • Offline Devices: Get-HPWarrantyEntitlement needs internet access to pull data from HP’s servers. Add retry logic in the script to handle offline scenarios.
  • Model Compatibility: Test the module on different HP device models to ensure consistent results.

内容的提问来源于stack exchange,提问作者ThatGuy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:41:59