If you need to set the ESXi Host Advanced System Setting Syslog.global.logHost on every ESXI Host in your environment here is some sample PowerCLI code to set the values. Connect to all your vCenters. Get all your hosts. Set the value and then it will reload the syslog service.

The second PowerCLI code example is to get the ESXi Host Advanced System Setting Syslog.global.logHost value on every ESXI Host in your environment.

A use case for this code is if the name/ip would change on your Log Insight Server or if you were asked to add a second syslog server. For my examples I wrote the values to the screen but the code could easily be changed to write the values to a csv file.

PowerCLI code to set the Syslog.global.logHost setting on every ESXi Host:

# 
#-------[Set Host Syslog.global.logHost Setting]------------------------------------------------------------------
#

# Connect to vcenter(s)

$vCenterName = 'vCenter01.vCrocs.info'
Connect-VIServer $vCenterName -Credential $cred

$vCenterName = 'vCenter01.vCrocs.info'
connect-viserver $vCenterName -Credential $cred

# Get all Host Names
$Hosts = Get-VMHost | Sort-Object Name

#Sets Syslog.global.logHost value and reloads syslog service
foreach($HostName in $Hosts){

    Write-Host 'ESXi Host: ' $HostName.Name
    
    #Set Syslog.global.logHost values on ESXi Host
    Set-VMHostSysLogServer -VMHost $HostName.Name -SysLogServer 'udp://loginsight.vCrocs.info:514,udp://splunk.vCrocs.info:514'
    
    #This command connects and make connection to specific server
    $esxcli =  Get-EsxCli -VMHost $HostName.Name -V2

    #Reload server syslog service
    $esxcli.system.syslog.reload.invoke()
    
} # end foreach

Disconnect-VIServer * -Confirm:$false

#

PowerCLI code to get the Syslog.global.logHost setting from every ESXi Host:

#
#-------[Get Host Syslog.global.logHost Setting]------------------------------------------------------------------
#

# Connect to vcenter(s)

$vCenterName = 'vCenter01.vCrocs.info'
Connect-VIServer $vCenterName -Credential $cred

$vCenterName = 'vCenter01.vCrocs.info'
connect-viserver $vCenterName -Credential $cred

# Get all Host Names
$Hosts = Get-VMHost | Sort-Object Name

#Get Syslog.global.logHost info
foreach($HostName in $Hosts){

    Write-Host 'ESXi Host: ' $HostName.Name
    
    $LogHosts = Get-VMHostSysLogServer -VMHost $HostName.Name

    foreach($LogHost in $LogHosts){

        Write-Host 'LogHost:   '$LogHost.Host

    } # end foreach

} # end foreach

Disconnect-VIServer * -Confirm:$false

#