Search code examples
powershellvmwarepowershell-4.0powerclivcenter

How to check if VMHost is configured with Syslog forwarding


I want to check if VMHost is configured with Syslog forwarding

I have written the following cmdlets but it is not giving "Syslog forwarding" status.

$esxcli = Get-EsxCli -VMHost abc.com
$esxcli.system.syslog | Select-Object *

$esxcli.system.syslog | gm is returning an error

gm : You must specify an object for the Get-Member cmdlet.
At line:1 char:25
+ $esxcli.system.syslog | gm
+ ~~
    + CategoryInfo : CloseError: (:) [Get-Member], InvalidOperationException
    + FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

$esxcli.system.syslog.config.get() is returning an error:

You cannot call a method on a null-valued expression.
At line:1 char:1
+ $esxcli.system.syslog.config.get()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Solution

  • PowerCLI includes the Get-VMHostSysLogServer cmdlet. In the context of your question, this command would return the Syslog Server for the VMHost abc.com:

    Get-VMHostSysLogServer -VMHost abc.com