Skip to content

Instantly share code, notes, and snippets.

@tatapbl4
Last active January 12, 2016 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatapbl4/3c5acd8f89ff7cda8258 to your computer and use it in GitHub Desktop.
Save tatapbl4/3c5acd8f89ff7cda8258 to your computer and use it in GitHub Desktop.
$LogInsightServer = "tcp:|udp://fqdn-or-ip:514"
Get-VMHost | Foreach {
Write-Host "Adding $LogInsightServer as Syslog server for $($_.Name)"
$SetSyslog = Set-VMHostSyslogServer -SyslogServer $LogInsightServer -VMHost $_
Write-Host "Reloading Syslog on $($_.Name)"
$Reload = (Get-ESXCLI -VMHost $_).System.Syslog.reload()
Write-Host "Setting firewall to allow Syslog out of $($_)"
$FW = $_ | Get-VMHostFirewallException | Where {$_.Name -eq 'syslog'} | Set-VMHostFirewallException -Enabled:$true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment