VMware Cloud Community
AlbertWT
Virtuoso
Virtuoso

Check ESXi specific service status using PowerCLI remotely?

Hi Folks,

Using this command: Get-VMHostService - vSphere PowerCLI Cmdlets Reference (vmware.com), I wonder if the PowerCLI can be used to check the status for the specific services like SSH and SLPD on each ESXi host in the vCenter?

Thank you.

/* Please feel free to provide any comments or input you may have. */
0 Kudos
3 Replies
LucD
Leadership
Leadership

Yes, it can
You could do something like this for example.

Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
    $services = Get-VMHostService -VMHost $esx
    New-Object -TypeName PSObject -Property ([ordered]@{
        VMHost = $esx.Name
        SSH = $services.Where{$_.Label -eq 'SSH'}.Running
        SLPD = $services.Where{ $_.Label -eq 'slpd' }.Running
        })
}


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

0 Kudos
bk7275
Contributor
Contributor

My PowerCLI is rusty how would I pipe those results to a CSV and then I would need to remediate by Cluster for servers that I find with the services on. 

 

0 Kudos
LucD
Leadership
Leadership

Just pipe the result to an Export-Csv
The last line becomes

} | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


For remediation, there have been several threads about that in the last couple of days.
See for example Solved: Re: Disable SFCB and SLP Services - VMware Technology Network VMTN


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

0 Kudos