PowerShell 网络交换机管理Network Switch Management with PowerShell

Get NetworkSwitchEthernetPort cmdlet 现在返回以下包含实例的附加信息:The Get-NetworkSwitchEthernetPort cmdlet now returns the following additional information with instances:

  • IPAddress – 与端口相关联的 IP 地址IPAddress – the IP address associated with the port
  • PortMode – 端口模式:Access、Route 或 TrunkPortMode – the port mode: access, route, or trunk
  • AccessVLAN – Access 模式中与此端口相关联的 VLAN 的 IDAccessVLAN – the ID of the VLAN associated with this port in access mode
  • TrunkedVLANList – Trunk 模式中与此端口相关联的 VLAN 的 ID 列表TrunkedVLANList – a list of IDs of VLANs associated with this port in trunk mode

Windows PowerShell 基本网络交换机管理Fundamental network switch management with Windows PowerShell

在 WMF 5.0 中引入的网络交换机 cmdlet 让你能够将交换机、虚拟 LAN (VLAN) 和基本第 2 层网络交换机端口配置应用到 Windows Server 2012 R2 徽标认证的网络交换机。The Network Switch cmdlets, introduced in WMF 5.0, enable you to apply switch, virtual LAN (VLAN), and basic Layer 2 network switch port configuration to Windows Server 2012 R2 logo-certified network switches. Microsoft 仍致力于支持数据中心抽象层 (DAL) 的愿景,从而为这一领域中的客户和合作伙伴彰显价值。Microsoft remains committed to supporting the Datacenter Abstraction Layer (DAL) vision, and to show value for our customers and partners in this space. 通过使用这些 cmdlet,你可以执行:Using these cmdlets you can perform:

  • 全局交换机配置,如:Global switch configuration, such as:

    • 设置主机名Set host name
    • 设置交换机横幅Set switch banner
    • 保留配置Persist configuration
    • 启用或禁用功能Enable or disable feature
  • VLAN 配置:VLAN configuration:

    • 创建或删除 VLANCreate or remove VLAN
    • 启用或禁用 VLANEnable or disable VLAN
    • 枚举 VLANEnumerate VLAN
    • 为 VLAN 设置友好名称Set friendly name to a VLAN
  • 第 2 层端口配置:Layer 2 port configuration:

    • 枚举端口Enumerate ports
    • 启用或禁用端口Enable or disable ports
    • 设置端口模式和属性Set port modes and properties
    • 添加或将 VLAN 关联到端口上的 Trunk 或 AccessAdd or associate VLAN to Trunk or Access on the port

通过查找所有 NetworkSwitch cmdlet 开始探索吧!Start exploring by looking for all of the NetworkSwitch cmdlets!

PS> Get-Command *-NetworkSwitch*

| CommandType | Name                                      | Source        |
|-------------|-------------------------------------------|---------------|
|             |                                           |               |
| Function    | Disable-NetworkSwitchEthernetPort         | NetworkSwitch |
| Function    | Disable-NetworkSwitchFeature              | NetworkSwitch |
| Function    | Disable-NetworkSwitchVlan                 | NetworkSwitch |
| Function    | Enable-NetworkSwitchEthernetPort          | NetworkSwitch |
| Function    | Enable-NetworkSwitchFeature               | NetworkSwitch |
| Function    | Enable-NetworkSwitchVlan                  | NetworkSwitch |
| Function    | Get-NetworkSwitchEthernetPort             | NetworkSwitch |
| Function    | Get-NetworkSwitchFeature                  | NetworkSwitch |
| Function    | Get-NetworkSwitchGlobalData               | NetworkSwitch |
| Function    | Get-NetworkSwitchVlan                     | NetworkSwitch |
| Function    | New-NetworkSwitchVlan                     | NetworkSwitch |
| Function    | Remove-NetworkSwitchEthernetPortIPAddress | NetworkSwitch |
| Function    | Remove-NetworkSwitchVlan                  | NetworkSwitch |
| Function    | Restore-NetworkSwitchConfiguration        | NetworkSwitch |
| Function    | Save-NetworkSwitchConfiguration           | NetworkSwitch |
| Function    | Set-NetworkSwitchEthernetPortIPAddress    | NetworkSwitch |
| Function    | Set-NetworkSwitchPortMode                 | NetworkSwitch |
| Function    | Set-NetworkSwitchPortProperty             | NetworkSwitch |
| Function    | Set-NetworkSwitchVlanProperty             | NetworkSwitch |

有关详细信息,请参阅 Jeffrey Snover 的 WMF 5.0 预览版公告博客文章:http://blogs.technet.com/b/windowsserver/archive/2014/04/03/windows-management-framework-v5-preview.aspxMore information is available in Jeffrey Snover’s WMF 5.0 Preview announcement blog post: http://blogs.technet.com/b/windowsserver/archive/2014/04/03/windows-management-framework-v5-preview.aspx