如何检查 VMHost 是否配置了 Syslog 转发

How to check if VMHost is configured with Syslog forwarding

我想检查 VMHost 是否配置了 Syslog 转发

我已经编写了以下 cmdlet,但未提供 "Syslog forwarding" 状态。

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

$esxcli.system.syslog | gm 返回错误

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() 返回错误:

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

PowerCLI 包含 Get-VMHostSysLogServer cmdlet。在您问题的上下文中,此命令将 return VMHost abc.com:

的 Syslog 服务器
Get-VMHostSysLogServer -VMHost abc.com