【问题标题】:Enable VLAN and set VLAN ID with powershell script if VLAN is not yet enabled如果 VLAN 尚未启用,则启用 VLAN 并使用 powershell 脚本设置 VLAN ID
【发布时间】:2021-11-09 13:19:26
【问题描述】:

我现在正在尝试在 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?

【问题讨论】:

    标签: powershell networking ethernet vlan windows-11


    【解决方案1】:

    尝试运行以下命令:

    Get-NetAdapterAdvancedProperty
    

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

     Set-NetAdapterAdvancedProperty -DisplayName "Jumbo*" -DisplayValue "4088 Bytes"
    

    【讨论】:

      最近更新 更多