VMware Cloud Community
rpabustan
Contributor
Contributor
Jump to solution

Export All Power Supply status of ESX Hosts using PowerCLI

Is there a way to export the status of all Power Supplies for all of our ESX Hosts?

Is this something that I can export to a csv file:

Capture.JPG

Thanks in advance!

1 Solution

Accepted Solutions
jrodsguitar
Enthusiast
Enthusiast
Jump to solution

You said PowerCli and this will export the data to a csv:

$vmhosts = get-vmhost

$results = @()

foreach($vmhost in $vmhosts){

(Get-View (Get-VMHost -Name $vmhost | Get-View).ConfigManager.HealthStatusSystem).ResetSystemHealthInfo()

(Get-View (Get-VMHost -Name $vmhost | Get-View).ConfigManager.HealthStatusSystem).RefreshHealthStatusSystem()

$result = ((Get-View $vmhost).runtime.healthsystemruntime.systemhealthinfo.numericsensorinfo) |

where{$_.name -like '*power*'}|

select @{Name='VMHost';Expression={$vmhost.Name}},name,@{Name='Sensordata';Expression={$_.healthstate.label}},currentreading,baseunits

$results += $result

}

$results | Export-Csv -Path c:\PATH_TO_SAVE_CSV.csv -NoTypeInformation

Blog: https://powershell.house/

View solution in original post

0 Kudos
3 Replies
sarikrizvi
Enthusiast
Enthusiast
Jump to solution

Select ESXi host >>> go to Hardware status Tab >> in top right corner , there is a option to "export" >>> it'll save data in xml file.

later on use xml file to csv or excel converter.

XML To CSV Converter

Regards,
SARIK (Infrastructure Architect)
vExpert 2018-2020 | vExpert - Pro | NSX | Security
vCAP-DCD 6.5 | vCP-DCV 5.0 | 5.5 | 6.0 | vCA-DCV 5 | vCA-Cloud 5 | RHCSA & RHCE 6 | A+ (HW & NW)
__________________
Please Mark "Helpful" or "Correct" if It'll help you
_____________________________________
@Follow:
Blog# https://vmwarevtech.com
vExpert# https://vexpert.vmware.com/directory/1997
Badge# https://www.youracclaim.com/users/sarik
0 Kudos
jrodsguitar
Enthusiast
Enthusiast
Jump to solution

You said PowerCli and this will export the data to a csv:

$vmhosts = get-vmhost

$results = @()

foreach($vmhost in $vmhosts){

(Get-View (Get-VMHost -Name $vmhost | Get-View).ConfigManager.HealthStatusSystem).ResetSystemHealthInfo()

(Get-View (Get-VMHost -Name $vmhost | Get-View).ConfigManager.HealthStatusSystem).RefreshHealthStatusSystem()

$result = ((Get-View $vmhost).runtime.healthsystemruntime.systemhealthinfo.numericsensorinfo) |

where{$_.name -like '*power*'}|

select @{Name='VMHost';Expression={$vmhost.Name}},name,@{Name='Sensordata';Expression={$_.healthstate.label}},currentreading,baseunits

$results += $result

}

$results | Export-Csv -Path c:\PATH_TO_SAVE_CSV.csv -NoTypeInformation

Blog: https://powershell.house/
0 Kudos
rpabustan
Contributor
Contributor
Jump to solution

Thank you sir!
Exactly what I need.Smiley Happy

0 Kudos