Connect-VIServer -Server
(Read-Host "what
is the vcenter to use?") -Credential
(Get-Credential -Message
"What is your VCenter Admin UserID &
PW")
$Syslog =
"udp://10.1.21.41:514"
$vmhosts =
get-vmhost
#practice
Run ## Remove Line 6 to complete all Hosts
$vmhosts =
$vmhosts|where {$_.name -eq "iad-esx-ucs1-05.st.com"}
foreach ($vmhost
in $vmhosts)
{
#Display
the ESXi Host being modified
Write-Output "Processing...
$($vmhost.name)"
#Set the
Syslog Server
$vmhost |
Get-AdvancedSetting -Name
Syslog.global.logHost | Set-AdvancedSetting
-Value $Syslog
-Confirm:$false
#Restart
the syslog service
$esxcli =
Get-EsxCli -VMHost
$vmhost
$esxcli.system.syslog.reload()
#Open
firewall ports
if(((Get-VMHostFirewallException -Name "syslog" -VMHost
$vmhost).Enabled)
-ne $true)
{Get-VMHostFirewallException
-Name "syslog"
-VMHost $vmhost
| set-VMHostFirewallException
-Enabled:$true}
}