我想要Get-NlbClusterNode
包含状态的项目"Converged"
(Enum of [Microsoft.NetworkLoadBalancingClusters.PowerShell.NodeStatusCode]
)
我尝试过这样的事情:
Get-NlbClusterNode | %{ $_.State | ?{$_.ToString() -eq "Converged"} }
但这让我只有匹配状态。
我试过contains
运营商
Get-NlbClusterNode | ?{ $_.State -ccontains "Converged"}
# or
Get-NlbClusterNode | ?{ $_.State -ccontains [Microsoft.NetworkLoadBalancingClusters.PowerShell.NodeStatusCode]::Converged}
但这对以太不起作用。
这是 PowerShell 对象
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>System.Collections.Generic.List`1[[Microsoft.NetworkLoadBalancingClusters.PowerShell.Node, Microsoft.NetworkLoadBalancingClusters.PowerShell, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
<T>System.Object</T>
</TN>
<LST>
<Obj RefId="1">
<TN RefId="1">
<T>Microsoft.NetworkLoadBalancingClusters.PowerShell.Node</T>
<T>System.Object</T>
</TN>
<ToString>Server02</ToString>
<Props>
<Obj N="Cluster" RefId="2">
<TN RefId="2">
<T>Microsoft.NetworkLoadBalancingClusters.PowerShell.Cluster</T>
<T>System.Object</T>
</TN>
<ToString />
<Props>
<S N="Name"></S>
<S N="ClusterIPAddress">192.168.0.20</S>
<S N="ClusterNetworkMask">255.255.255.0</S>
<S N="ClusterMacAddress">03-12-c0-a8-56-ac</S>
<S N="OperationMode">MULTICAST</S>
<B N="BdaReverseHash">false</B>
<B N="BdaTeamActive">false</B>
<Nil N="BdaTeamId" />
<B N="BdaTeamMaster">false</B>
</Props>
<MS>
<S N="ClusterName"></S>
<S N="IPAddress">192.168.0.20</S>
</MS>
</Obj>
<S N="Name">Server02</S>
<S N="InterfaceName">NLB</S>
<S N="Host">Server02</S>
<Obj N="State" RefId="3">
<TN RefId="3">
<T>Microsoft.NetworkLoadBalancingClusters.PowerShell.NodeStatus</T>
<T>System.Object</T>
</TN>
<ToString>Converged</ToString>
<Props>
<S N="NodeStatusCode">Converged</S>
</Props>
</Obj>
<I32 N="HostPriority">4</I32>
<S N="AdapterGuid">{8FEAE540-F32E-42D0-940B-6E34E5977E77}</S>
<Obj N="InitialHostState" RefId="4">
<TN RefId="4">
<T>Microsoft.NetworkLoadBalancingClusters.PowerShell.NodeInitialHostState</T>
<T>System.Enum</T>
<T>System.ValueType</T>
<T>System.Object</T>
</TN>
<ToString>Started</ToString>
<I32>1</I32>
</Obj>
<B N="PersistSuspendOnReboot">false</B>
<B N="MaskSourceMac">true</B>
<I32 N="FilterIcmp">0</I32>
<I32 N="GreDescriptorTimeout">10</I32>
</Props>
</Obj>
<Obj RefId="5">
<TNRef RefId="1" />
<ToString>Server01</ToString>
<Props>
<Ref N="Cluster" RefId="2" />
<S N="Name">Server01</S>
<S N="InterfaceName">NLB</S>
<S N="Host">Server01</S>
<Obj N="State" RefId="6">
<TNRef RefId="3" />
<ToString>Converged(default)</ToString>
<Props>
<S N="NodeStatusCode">Default</S>
</Props>
</Obj>
<I32 N="HostPriority">3</I32>
<S N="AdapterGuid">{B47F1065-2E61-49A9-BFBB-E172EA9444E6}</S>
<Obj N="InitialHostState" RefId="7">
<TNRef RefId="4" />
<ToString>Started</ToString>
<I32>1</I32>
</Obj>
<B N="PersistSuspendOnReboot">false</B>
<B N="MaskSourceMac">true</B>
<I32 N="FilterIcmp">0</I32>
<I32 N="GreDescriptorTimeout">10</I32>
</Props>
</Obj>
</LST>
</Obj>
</Objs>
这是类型Microsoft.NetworkLoadBalancingClusters.PowerShell.Node
TypeName: Microsoft.NetworkLoadBalancingClusters.PowerShell.Node
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
AdapterGuid Property string AdapterGuid {get;set;}
Cluster Property Microsoft.NetworkLoadBalancingClusters.PowerShell.Cluster Cluster {get;set;}
FilterIcmp Property int FilterIcmp {get;set;}
GreDescriptorTimeout Property int GreDescriptorTimeout {get;set;}
Host Property string Host {get;set;}
HostPriority Property int HostPriority {get;set;}
InitialHostState Property Microsoft.NetworkLoadBalancingClusters.PowerShell.NodeInitialHostState InitialHost
InterfaceName Property string InterfaceName {get;set;}
MaskSourceMac Property bool MaskSourceMac {get;set;}
Name Property string Name {get;set;}
PersistSuspendOnReboot Property bool PersistSuspendOnReboot {get;set;}
State Property Microsoft.NetworkLoadBalancingClusters.PowerShell.NodeStatus State {get;set;}