启用 VLAN 并使用 powershell 脚本设置 VLAN ID(如果尚未启用 VLAN)

问题描述 投票:0回答:1

我现在正在尝试在 Windows 11 中编写一个 powershell 脚本,该脚本应该自动配置 USB 到以太网适配器。为此,我需要自动配置适配器的 VLAN。

如果 VLAN 已在网络对话框中使用

激活,则一切正常
Set-NetAdapter -Name Adapter -VlanID 999

如果尚未配置网络适配器,脚本将失败并显示:

Set-NetAdapter : Requested operation not supported on adapter

屏幕截图*显示了如何禁用适配器上的 VLAN:

有谁知道如何在设置 VLAN ID 之前首先使用 powershell 启用 VLAN?

*“Nicht vorhanden”= 不可用

powershell networking ethernet vlan windows-11
1个回答
3
投票

尝试运行以下命令:

Get-NetAdapterAdvancedProperty

如果您用它进行测试,您应该能够知道需要设置哪些属性,例如

 Set-NetAdapterAdvancedProperty -DisplayName "Jumbo*" -DisplayValue "4088 Bytes"
© www.soinside.com 2019 - 2024. All rights reserved.