I have got a PowerCli script for this :smileyhappy: - we are facing the same bug on HP blades in our environment
What it does is basically everything described above, but without tne hassle of connecting to each host manually - it's a little bit modular so take a look on the code first if you understand the mnemonics, if not just run it, enter your vCenter and VM name (don't forget to see the $hosts value - it should contain your domain't name!) and wait for a moment :smileywink:
Write-Host
"Reset sensors, refresh HW data & their views on an ESXi host"
`n
-ForegroundColor
Green
$hosts
= @()
if
(
$vcenterlist
-eq
$null
) {
do
{
[Boolean]
$match
=
$false
$vcenter
=
Read-Host
"Define a vCenter where the host is located"
$vcenter
.Replace(
' '
,
''
)
if
(
$vcenter
-notlike
"
") { $match = $true }
Else {
Write-Host "
The value must not be null. Try again or CTRL+C to
break
.
"`n -ForegroundColor Red
$match = $false
}
} Until ($match -eq $true)
}
# ESXi host definition
$input = Read-Host "
Enter a name of ESXi host where you want to reset the HW sensors
"
# Generate FQDN and store into an Array
$hosts += "
$input
`.yourdomain.lab
"
# Connect to vCenter
Write-Host `n "
Connecting to vCenter
$vcenter
`...
"
ForEach ($vcenter in $vcenterlist) {
Connect-VIServer $vcenter | Out-Null
}
# The VMhost needs to be stored into an array with Get-VMhost for further processing
$vmhosts = Get-VMHost -Name $hosts
# Get all vmhosts for the connected vCenter sessions
#$vmhosts = Get-VMHost
ForEach ($vmhost in $vmhosts)
{
Try
{
#initialize calls for refreshing hardware status..
Write-Host "
Restarting CIM Server service on
$vmhost
"
Get-VMHost $vmhost | Get-VMHostService | Where { $_.Key -eq “sfcbd-watchdog” } | Restart-VMHostService -Confirm:$false | Out-Null
Start-Sleep -Seconds 15
Write-Host "
Starting to refresh HW info on
$vmhost
(this can take a
while
)
"
# Define variables for system calls
$hv = Get-View $vmhost
$hss = get-view $hv.ConfigManager.HealthStatusSystem
Write-Host "
Resetting HW Sensors...
"
$hss.ResetSystemHealthInfo()
Start-Sleep -Seconds 15
Write-Host "
Refreshing Data...
"
$hss.RefreshHealthStatusSystem()
Start-Sleep -Seconds 15
Write-Host "
Refreshing Data View...
"
$hss.UpdateViewData()
Start-Sleep -Seconds 15
}
Catch [System.Exception]
{
Write-Host "
There was an error
while
trying to refresh the hardware data.
" `n `
"
Please check the ESXi host
's Hardware Status Tab." -ForegroundColor '
Red'
}
Finally
{
Write-Host
"Disconnecting from the vCenter Server...
"
Disconnect-VIServer $vcenter -Confirm:$false
Write-Host "
Done processing
$vmhost
."
-ForegroundColor
Green
}
}