Let’s say that we would like to change the syslog server to which our esxi5 boxes is sending logs in some particular cluster.
[sourcecode language=”powershell”]
$changedValue = New-Object VMware.Vim.OptionValue[] (1)
$changedValue[0] = New-Object VMware.Vim.OptionValue
$changedValue[0].key = "Syslog.global.logHost"
$changedValue[0].value = "tcp:/your-syslog-ip:514"
Get-View -ViewType HostSystem -Searchroot (Get-Cluster "your-cluster-name").Id | %{
$optMgr = Get-View $_.ConfigManager.AdvancedOption
$optMgr.UpdateOptions($changedValue)
}
[/sourcecode]
Now check if we have updated values
[sourcecode language=”powershell”]
get-view -viewtype HostSystem -SearchRoot (get-cluster "our-cluster").id | % { get-view $_.ConfigManager.AdvancedOption | select -ExpandProperty Setting |?{$_.Key -like "Syslog.global.logHost"} }
[/sourcecode]
Many thanks to LucD for pointing me out a better way to go with updating this value!
