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.
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
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.
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