重新排列 Hyper-V 可扩展交换机扩展的顺序

可以在可扩展交换机的每个实例中启用多个 Hyper-V 可扩展交换机捕获或筛选扩展。

注意 在可扩展交换机的每个实例中只能启用一个转发扩展。

默认情况下,多个捕获或筛选扩展根据其类型和安装时间进行排序。 例如,多个捕获扩展在可扩展交换机驱动程序堆栈中分层,其中最近安装的扩展最接近交换机的协议边缘。

安装多个捕获或筛选扩展后,可以使用 PowerShell cmdlet 对可扩展交换机驱动程序堆栈中的驱动程序重新排序。 以下示例演示从 PowerShell 窗口输入的用于执行此操作的命令。

# Show the current order. The ExtensionOrder field contains paths to WMI extension instances.
# The [wmi] operator can be used to convert the paths to full WMI objects. 
PS C:\Windows\system32> $privateNetwork = Get-VMSwitch PrivateNetwork
PS C:\Windows\system32> $extensionOrder = $privateNetwork.ExtensionOrder
PS C:\Windows\system32> $extensionOrder | ForEach-Object { Write-Host "Name:" ([wmi]$_).ElementName }
Name: NDIS Capture LightWeight Filter
Name: Switch Extensibility Test Extension 2
Name: Switch Extensibility Test Extension 1
Name: WFP extensible switch Layers LightWeight Filter

# Place “Test Extension 1” above “Test Extension 2” in the ordered list of extensions.
PS C:\Windows\system32> $tmp = $extensionOrder[1]
PS C:\Windows\system32> $extensionOrder[1] = $extensionOrder[2]
PS C:\Windows\system32> $extensionOrder[2] = $tmp

# Commit the updated order.
PS C:\Windows\system32> $privateNetwork.ExtensionOrder = $extensionOrder

# Retrieve the switch information again to validate the order.
PS C:\Windows\system32> $privateNetwork = Get-VMSwitch PrivateNetwork
PS C:\Windows\system32> $privateNetwork.ExtensionOrder | ForEach-Object { Write-Host "Name:" ([wmi]$_).ElementName }
Name: NDIS Capture LightWeight Filter
Name: Switch Extensibility Test Extension 1

Get-VMSwitch

Msvm_EthernetSwitchExtension

Msvm_VirtualEthernetSwitchSettingData