我想检查VMHost是否配置了Syslog转发
我已经编写了以下cmdlet,但未提供“ Syslog转发”状态。
$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
答案 0 :(得分:1)
PowerCLI包含Get-VMHostSysLogServer
cmdlet。在您的问题上下文中,此命令将为VMHost abc.com返回Syslog服务器:
Get-VMHostSysLogServer -VMHost abc.com