Add-VMSwitchExtensionPortFeature

Add-VMSwitchExtensionPortFeature

Adds a feature to a virtual network adapter.

Syntax

Parameter Set: VMName
Add-VMSwitchExtensionPortFeature [-VMName] <String[]> -VMSwitchExtensionFeature <VMSwitchExtensionPortFeature[]> [-ComputerName <String[]> ] [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ExternalPort
Add-VMSwitchExtensionPortFeature [-SwitchName] <String> -ExternalPort -VMSwitchExtensionFeature <VMSwitchExtensionPortFeature[]> [-ComputerName <String[]> ] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ManagementOS
Add-VMSwitchExtensionPortFeature -ManagementOS -VMSwitchExtensionFeature <VMSwitchExtensionPortFeature[]> [-ComputerName <String[]> ] [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ResourceObject
Add-VMSwitchExtensionPortFeature [-VMNetworkAdapter] <VMNetworkAdapterBase[]> -VMSwitchExtensionFeature <VMSwitchExtensionPortFeature[]> [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Add-VMSwitchExtensionPortFeature [-VM] <VirtualMachine[]> -VMSwitchExtensionFeature <VMSwitchExtensionPortFeature[]> [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-VMSwitchExtensionPortFeature cmdlet adds a feature supported by a virtual switch extension to a virtual machine network adapter. This cmdlet also configures built-in virtual switch features.

Parameters

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which a feature is to be added to a virtual network adapter. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer — use “localhost” or a dot (“.”) to specify the local computer explicitly.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExternalPort

Specifies the virtual switch port connected to the external network interface card.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ManagementOS

Specifies that the feature is to be added in the management (i.e. the parent, or host) operating system.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Passthru

Specifies that an object is to be passed through to the pipeline representing the feature to be added.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SwitchName<String>

Specifies the name of the virtual switch.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VM<VirtualMachine[]>

Specifies the virtual machine in which the feature is to be added.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMName<String[]>

Specifies the name of the virtual machine in which the feature is to be added.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMNetworkAdapter<VMNetworkAdapterBase[]>

Specifies the virtual machine network adapter for which the feature is to be added.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMNetworkAdapterName<String>

Specifies the name of the virtual machine network adapter for which the feature is to be added.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMSwitchExtensionFeature<VMSwitchExtensionPortFeature[]>

Specifies the feature to be added to the virtual switch. You can get such a feature object from Get-VMSystemSwitchExtensionPortFeature to add a new configuration to a virtual network adapter, or from the Get-VMSwitchExtensionPortFeature cmdlet to update an existing configuration.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None by default; Microsoft.HyperV.PowerShell.VMSwitchExtensionPortFeature if –PassThru is specified.

Examples

Example 1

Adds a feature to virtual machine VM2. The feature here is a port security feature supported by the extension Microsoft Virtual Ethernet Switch Native Extension.

PS C:\> $feature = Get-VMSystemSwitchExtensionPortFeature -FeatureName "Ethernet Switch Port Security Settings"
PS C:\> $feature.SettingData.EnableDhcpGuard = $true
PS C:\> $feature.SettingData.EnableRouterGuard = $true
PS C:\> Add-VMSwitchExtensionPortFeature -VMName VM2 -VMSwitchExtensionFeature $feature