Hi
I am getting below error when I run the below script, Please help
$report = Get-Cluster |
Get-VMHost -PipelineVariable vmhost |
ForEach-Object {
$esxcli = Get-EsxCli -VMHost $vmhost -V2
Write-Host -ForegroundColor green "Server: $($vmhost.Name)"
$esxcli.storage.nmp.device.list.Invoke() | where { $_.Device -match "^eui\.\w{16}(6c9ce9|6C9CE9)\w{10}"}
$esxcli.storage.nmp.psp.roundrobin.deviceconfig.list.Invoke() | where {$_.Vendor -eq "Nimble"} | select @{N="VMHost";E={$vmhost.Name }}, Description, Name, Vendor, Model, RuleGroup, DefaultPSP, PSPOptions
}
$report
Output
You cannot call a method on a null-valued expression.
At D:\myreports\Multipath_Rules\1_Nimble_List_SATP_rules.ps1:43 char:5
+ $esxcli.storage.nmp.psp.roundrobin.device.list.Invoke()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
