Os cmdlets do Gerenciador de Comutador de Rede podem ser usados para gerenciar os comutadores de rede em WSMAN.The Network Switch Manager cmdlets can be used to manage network switches over WSMAN. Alguns cmdlets do módulo são capazes de aceitar valores de pipelines.A few cmdlets of this module are capable of accepting values from pipelines. Na Preview do 5.1 WMF, os cmdlets que podem aceitar o valor de pipeline não poderão ser executados quando os valores não forem passados pelos pipelines.In WMF 5.1 Preview, the cmdlets that can accept value from pipeline fail to execute when the values are not passed through pipelines.

Se o parâmetro "InputObject" não for usado, o cmdlet deverá continuar a execução sem falhas.If "InputObject" parameter is not used, the cmdlet should continue to execute without failures.

Aqui está a lista dos cmdlets afetados, ou seja, esses cmdlets pode aceitar o valor para o parâmetro "InputObject" de pipeline.Here is the list of affected cmdlets i.e. these cmdlets can accept value for "InputObject" parameter from pipeline. Se esse valor não for passado do pipeline, a execução do cmdlet falhará.If this value is not passed from pipeline the execution of cmdlet will fail.

  • Disable-NetworkSwitchEthernetPoDisable-NetworkSwitchEthernetPort
  • Enable-NetworkSwitchEthernetPortEnable-NetworkSwitchEthernetPort
  • Remove-NetworkSwitchEthernetPortIPAddressRemove-NetworkSwitchEthernetPortIPAddress
  • Set-NetworkSwitchEthernetPortIPAddressSet-NetworkSwitchEthernetPortIPAddress
  • Set-NetworkSwitchPortModeSet-NetworkSwitchPortMode
  • Set-NetworkSwitchPortPropertySet-NetworkSwitchPortProperty
  • Disable-NetworkSwitchFeatureDisable-NetworkSwitchFeature
  • Enable-NetworkSwitchFeatureEnable-NetworkSwitchFeature
  • Remove-NetworkSwitchVlanRemove-NetworkSwitchVlan
  • Set-NetworkSwitchVlanPropertySet-NetworkSwitchVlanProperty

ResoluçãoResolution

Os cmdlets funcionam bem quando o valor do parâmetro InputObject é passado pelo pipeline.The cmdlets work fine when the value of InputObject parameter are passed into it through pipeline. Alguns exemplos que funcionam para os cmdlets acima são:A few examples that work for the above cmdlets are:

  • Disable-NetworkSwitchEthernetPoDisable-NetworkSwitchEthernetPort powershell $port = Get-CimInstance -Namespace root/interop -ClassName CIM_EthernetPort -CimSession $cimSession | Select-Object -First 1 $port | Disable-NetworkSwitchEthernetPort -CimSession $cimSession
  • Enable-NetworkSwitchEthernetPortEnable-NetworkSwitchEthernetPort

    $port = Get-CimInstance -Namespace root/interop -ClassName CIM_EthernetPort -CimSession $cimSession | Select-Object -First 1
    $port | Enable-NetworkSwitchEthernetPort -CimSession $cimSession
    
  • Remove-NetworkSwitchEthernetPortIPAddressRemove-NetworkSwitchEthernetPortIPAddress

    $port = Get-CimInstance -Namespace root/interop -ClassName CIM_EthernetPort -CimSession $cimSession | Select-Object -First 1
    $port | Remove-NetworkSwitchEthernetPortIPAddress -CimSession $cimSession
    
  • Set-NetworkSwitchEthernetPortIPAddressSet-NetworkSwitchEthernetPortIPAddress

    $port = Get-CimInstance -Namespace root/interop -ClassName CIM_EthernetPort -CimSession $cimSession | Select-Object -First 1
    $ipAddress = "192.168.10.1"
    $subnetAddress = "255.255.255.0"
    $port | Set-NetworkSwitchEthernetPortIPAddress -IpAddress $ipAddress -SubnetAddress $subnetAddress -CimSession $cimSession
    
  • Set-NetworkSwitchPortPropertySet-NetworkSwitchPortProperty

    $portProperties = @{Caption = "New Caption"}
    $port = Get-CimInstance -Namespace root/interop -ClassName CIM_EthernetPort -CimSession $cimSession | Select-Object -First 1
    $port | Set-NetworkSwitchPortProperty -Property $portProperties -CimSession $cimSession
    
  • Disable-NetworkSwitchFeatureDisable-NetworkSwitchFeature

    $feature = Get-CimInstance -Namespace root/interop -ClassName MSFT_Feature -CimSession $cimSession | Select-Object -First 1
    $feature | Disable-NetworkSwitchFeature -CimSession $cimSession
    
  • Enable-NetworkSwitchFeatureEnable-NetworkSwitchFeature

    $feature = Get-CimInstance -Namespace root/interop -ClassName MSFT_Feature -CimSession $cimSession | Select-Object -First 1
    $feature | Enable-NetworkSwitchFeature -CimSession $cimSession
    
  • Set-NetworkSwitchVlanPropertySet-NetworkSwitchVlanProperty

    $properties = @{Caption = "New Caption"}
    $vlan = Get-CimInstance -ClassName CIM_NetworkVlan -Namespace root/interop -CimSession $cimSession | Select-Object -First 1
    $vlan | Set-NetworkSwitchVlanProperty -Property $properties -CimSession $cimSession