VMware Cloud Community
sjoshi25
Contributor
Contributor

Script to Export status of services running on all ESX Hosts

Hello Everyone,

We want to export the status of all services running on all ESX Hosts for an audit. Is there a PowerCLI script to export this data in CSV for all ESX hosts from multiple vCenters. 

0 Kudos
3 Replies
LucD
Leadership
Leadership

Do you mean all the services returned by Get-VMHostService?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sjoshi25
Contributor
Contributor

Yes the result returned by Get-VMHostService

Tags (1)
0 Kudos
LucD
Leadership
Leadership

You could do something like this.
It assumes the credentials for all vCenters are the same.

$vcNames = 'vc1','vc2','vc3'
Connect-VIServer -Server $vcNames -Credential $cred

Get-VMHost | Get-VMHostService |
Select @{N='VMHost';E={$_.VMHost.Name}},Key,Running |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos