Changing VMware ESXi 5.1 Syslog settings via PowerCLI

Changing VMware ESXi 5.1 Syslog settings via PowerCLI

Here is a quick and easy method to change the syslog settings on multiple ESX hosts using PowerCLI. First connect to your VC in PowerCLI and then run the below to see your current remote syslog server on each of the ESXi Hosts:

get-vmhost | Get-VMHostAdvancedConfiguration -Name

After getting that information you can then push out new changes:

#Get Each Host Connected to the vC
foreach ($myHost in get-VMHost)
    #Display the ESXi Host that you are applying the changes to
    Write-Host ‘$myHost = ‘ $myHost

    #Set the Syslog LogHost
    Set-VMHostAdvancedConfiguration -Name -Value ‘,’ -VMHost $myHost
    #Use Get-EsxCli to restart the syslog service
    $esxcli = Get-EsxCli -VMHost $myHost

    #Open the firewall on the ESX Host to allow syslog traffic
    Get-VMHostFirewallException -Name “syslog” -VMHost $myHost | set-VMHostFirewallException -Enabled:$true

For more information on set-VMHostAdvancedConfiguration take a look at

4 thoughts on “Changing VMware ESXi 5.1 Syslog settings via PowerCLI

  1. I'm digging through my PowerCLI reference to find how to get your first command to display the names of each host alongside these syslog setting:

    PowerCLI D:scripts> get-vmhost | get-VMHostAdvancedConfigu

    Name Value
    —- —– tcp://

    Apologies for asking such a newbie question here.

    I just want a third column showing the esxhostname.

    If I find it before anyone can post it here, I'll post it here myself to share.


  2. Have you tried something along the lines of:

    foreach ($myHost in get-VMHost)
    Get-VMHostAdvancedConfiguration -Name -VMHost $myHost
    Write-host $myHost

    Alternatively you could do:
    foreach ($myHost in get-VMHost)
    Get-VMHostAdvancedConfiguration -Name,Vpx.Vpxa.config.vpxa.hostIp -VMHost $myHost
    but that will only give you the IP and not the FQDN.

Leave a Reply

Your email address will not be published. Required fields are marked *