vCheck syslog plugin update

I regularly use Alan Renouf’s excellent vCheck powershell utility to help me manage and maintain some sort or order with my ESXi hosts.

Unfortunately the good people at VMware are charging ahead advancing the features of vSphere, which means that some useful powercli commands are deprecated from time to time.  This can break some vCheck plugins and hence the authors are often pestered for updates to support the newer versions of ESXi.

I am in the process of validating plugins which are broken, and adapting them to support new releases whilst still having backwards compatibility.  Of course I am sharing this info with the original authors, whom no doubt can code a little prettier than me, but at least I have an interim solution.  Anyway, here is my first one to address the new way in which the syslog server detials is queried on ESXi 5.x based upon the good work of Jonathan Medd‘s original plugin:

# Start of Settings
# The Syslog server which should be set on your hosts
$SyslogServer =”syslog.domain.local”
# End of Settings

$ESXiSyslog = @()
$ESXiSyslog += $VMH | Where { $_.Version -lt 5.0 } | Where {$_.ConnectionState -eq “Connected” -or $_.ConnectionState -eq “Maintenance”} | Select Name, @{Name=’SyslogServer’;Expression={($_ | Get-VMHostSysLogServer).Host}} | Where-Object {$ -ne $syslogserver}
$ESXiSyslog += $VMH | Where { $_.Version -ge “5.0.0” } | Where {$_.ConnectionState -eq “Connected” -or $_.ConnectionState -eq “Maintenance”} | Where {$_.ExtensionData.Summary.Config.Product.Name -match “i”} | Select Name, @{Name=”SyslogServer”;Expression={(Get-VMHost $_.Name | Get-VMHostAdvancedConfiguration -Name}}

$Result = @($ESXiSyslog | Where { $_.SyslogServer -ne $syslogserver})

$Title = “Hosts with incorrect or empty Syslog Server defined”
$Header = “Hosts with incorrect or empty Syslog Server defined : $(@($Result).count)”
$Comments = “The following hosts do not have the correct Syslog settings which may cause issues if ESXi hosts experience issues and logs need to be investigated”
$Display = “Table”
$Author = “John Murray based on orginal scripts from Alan Renouf & Jonathan Medd”
$PluginVersion = 1.2
$PluginCategory = “vSphere”