POWERCLI assistance please.
So, I am confused as to why the NAME does NOT result in the hostname, yet rather Syslog.global.logHost
How does I get the vSphere host name to be listed with the Value? Basically looking to get the value of each vSphere host.
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-Cluster QA | Get-VMHost | Get-VMHostAdvancedConfiguration -Name Syslog.global.logHost
Name Value
---- -----
Syslog.global.logHost udp://xxlogger.xxx.com:514
Syslog.global.logHost xxlogger.xxx.com
Syslog.global.logHost xxlogger.xxx.com
Thx
Try this:
foreach ($esxi in (Get-Cluster -Name QA | Get-VMHost | Sort Name)) { $esxi | Select Name, @{N="Syslog";E={Get-VMHostSysLogServer -VMHost $esxi | %{$_.Host + ":" + $_.Port}}}}
Try this:
foreach ($esxi in (Get-Cluster -Name QA | Get-VMHost | Sort Name)) { $esxi | Select Name, @{N="Syslog";E={Get-VMHostSysLogServer -VMHost $esxi | %{$_.Host + ":" + $_.Port}}}}
Get-VMHostAdvancedConfiguration is a deprecated command. This PowerCLI should do the trick. This command is quicker than the command of ssbkang as he uses the port as a seperate value. My command just grabs the configuration from the advanced settings of the vSphere host. NB, you need to change the clustername back to QA in my example.
Get-Cluster -Name Mini | Get-VMHost | Select Name, @{N="Syslog logHost";E={(Get-Advanced Setting -Entity $_ -Name "Syslog.global.logHost").Value}}
And provides output like this:
Name Syslog logHost
---- --------------
mini1.vcaplab.local 192.168.1.10
mini2.vcaplab.local 192.168.1.10
Hope this helps,
Tom
ODD.. My Syslog logHost results result in blank values.. even the ones with values.
This script for both ESXi 4.1 and 5.0 ?
This worked superbly. I wish I knew how you figured out to begin your script with foreach ($esxi in (Get-Cluster -Name...
rather than
Get-Cluster QA | Get-VMHost
foreach isn't necessary, it can still be started with Get-Cluster QA | Get-VMHost which is eventually the same thing!
The reason why Get-Cluster QA | Get-VMHost | Select Name, @{N="Syslog";E={(Get-AdvancedSetting -Entity $_ -Name "Syslog.Global.LogHost").Value}} doesn't work for ESXi 4.1 is that the name of the syslog field has been changed:
Which means, you will need to run the command twice:
Hope this helps,
Steven.