Replace where with Where-Object

This commit is contained in:
Markus Kraus
2020-05-07 20:34:28 +02:00
parent 228de51f25
commit 0c3ff917d0

View File

@@ -88,13 +88,13 @@ Begin {
$obj.vmnic = $physnic.Device $obj.vmnic = $physnic.Device
$obj.PCI = $physnic.PCI $obj.PCI = $physnic.PCI
$obj.MAC = $physnic.Mac $obj.MAC = $physnic.Mac
if ($backing = ($VMhostProxySwitch | where {$_.Spec.Backing.PnicSpec.PnicDevice -eq $physnic.Device})) { if ($backing = ($VMhostProxySwitch | Where-Object {$_.Spec.Backing.PnicSpec.PnicDevice -eq $physnic.Device})) {
$obj.VDS = $backing.DvsName $obj.VDS = $backing.DvsName
} }
else { else {
$obj.VDS = "-No Backing-" $obj.VDS = "-No Backing-"
} }
if ($backing = ($VMhostSwitch | where {$_.Nic -eq $physnic.Device})) { if ($backing = ($VMhostSwitch | Where-Object {$_.Nic -eq $physnic.Device})) {
$obj.vSwitch = $backing.name $obj.vSwitch = $backing.name
} }
else { else {
@@ -116,7 +116,7 @@ Begin {
if( $hint.LldpInfo ) { if( $hint.LldpInfo ) {
$obj.LLDP_Port = $hint.LldpInfo.PortId $obj.LLDP_Port = $hint.LldpInfo.PortId
$obj.LLDP_Chassis = $hint.LldpInfo.ChassisId $obj.LLDP_Chassis = $hint.LldpInfo.ChassisId
$obj.LLDP_SystemName = ($hint.LldpInfo.Parameter | where key -eq "System Name").Value $obj.LLDP_SystemName = ($hint.LldpInfo.Parameter | Where-Object key -eq "System Name").Value
} }
else { else {
$obj.LLDP_Port = "-No Info-" $obj.LLDP_Port = "-No Info-"