편집

다음을 통해 공유


Set-VMNetworkAdapterVlan

Configures the virtual LAN settings for the traffic through a virtual network adapter.

Syntax

VMName (Default)

Set-VMNetworkAdapterVlan
    [-VMName] <String[]>
    [-VMNetworkAdapterName <String>]
    [-CimSession <CimSession[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential[]>]
    [-Untagged]
    [-Access]
    [-VlanId <Int32>]
    [-Trunk]
    [-NativeVlanId <Int32>]
    [-AllowedVlanIdList <String>]
    [-Isolated]
    [-Community]
    [-Promiscuous]
    [-PrimaryVlanId <Int32>]
    [-SecondaryVlanId <Int32>]
    [-SecondaryVlanIdList <String>]
    [-Passthru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ResourceObject

Set-VMNetworkAdapterVlan
    [-VMNetworkAdapter] <VMNetworkAdapterBase[]>
    [-Untagged]
    [-Access]
    [-VlanId <Int32>]
    [-Trunk]
    [-NativeVlanId <Int32>]
    [-AllowedVlanIdList <String>]
    [-Isolated]
    [-Community]
    [-Promiscuous]
    [-PrimaryVlanId <Int32>]
    [-SecondaryVlanId <Int32>]
    [-SecondaryVlanIdList <String>]
    [-Passthru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ManagementOS

Set-VMNetworkAdapterVlan
    [-ManagementOS]
    [-VMNetworkAdapterName <String>]
    [-CimSession <CimSession[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential[]>]
    [-Untagged]
    [-Access]
    [-VlanId <Int32>]
    [-Trunk]
    [-NativeVlanId <Int32>]
    [-AllowedVlanIdList <String>]
    [-Isolated]
    [-Community]
    [-Promiscuous]
    [-PrimaryVlanId <Int32>]
    [-SecondaryVlanId <Int32>]
    [-SecondaryVlanIdList <String>]
    [-Passthru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

VMObject

Set-VMNetworkAdapterVlan
    [-VM] <VirtualMachine[]>
    [-VMNetworkAdapterName <String>]
    [-Untagged]
    [-Access]
    [-VlanId <Int32>]
    [-Trunk]
    [-NativeVlanId <Int32>]
    [-AllowedVlanIdList <String>]
    [-Isolated]
    [-Community]
    [-Promiscuous]
    [-PrimaryVlanId <Int32>]
    [-SecondaryVlanId <Int32>]
    [-SecondaryVlanIdList <String>]
    [-Passthru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-VMNetworkAdapterVlan cmdlet configures virtual LAN settings for the traffic through a virtual network adapter. Access, Trunk, Private VLAN (isolated, community, or promiscuous), and untagged are mutually exclusive.

Examples

Example 1

PS C:\> Set-VMNetworkAdapterVlan -VMName Redmond -Access -VlanId 121

Sets the virtual network adapter(s) in virtual machine Redmond to the Access mode. Traffic sent by this virtual machine is tagged with VLAN ID 121.

Example 2

PS C:\> Set-VMNetworkAdapterVlan -VMName Redmond -Trunk -AllowedVlanIdList 1-100 -NativeVlanId 10

Sets the virtual network adapter(s) in virtual machine Redmond to the Trunk mode. Any traffic tagged with one of the VLAN IDs in the allowed VLAN list will be permitted to be sent or received by the VLAN. If traffic is untagged, it will be treated as if it were on VLAN 10.

Example 3

PS C:\> Get-VMNetworkAdapter -VMName Redmond | Set-VMNetworkAdapterVlan -Isolated -PrimaryVlanId 10 -SecondaryVlanId 200

Gets the virtual network adapters from virtual machine Redmond and sets them to the Private VLAN isolated mode, where primary VLAN is 10 and the secondary VLAN is 200.

Example 4

PS C:\> Get-VMNetworkAdapter -VMName WA | Set-VMNetworkAdapterVlan -Promiscuous -PrimaryVlanId 10 -SecondaryVlanIdList 200-201

Gets the virtual network adapters from virtual machine WA and sets them to the Private VLAN promiscuous mode, where primary VLAN is 10 and the secondary VLANs are 201 and 202.

Example 5

PS C:\> Get-VM Redmond | Set-VMNetworkAdapterVlan -Untagged

Gets virtual machine Redmond and sets the virtual network adapters in the virtual machine to the untagged mode.

Example 5

PS C:\> Set-VMNetworkAdapterVlan -ManagementOS -Access -VlanID 20

Sets the virtual switch in the management OS to the Access mode. Traffic sent by this virtual switch is tagged with VLAN ID 20.

Parameters

-Access

Specifies Access mode for the virtual machine network adapter. This parameter configures an untagged virtual port with the VLANId (port based VLAN), so it must be specified together with VlanId.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:a

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AllowedVlanIdList

Specifies a list of virtual LANs allowed on a virtual machine network adapter. This parameter must be specified in conjunction with the switch parameter Trunk.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ManagementOS
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Community

Specifies Community mode for the virtual machine network adapter to be configured. This parameter must be specified in conjunction with parameters PrimaryVlanId and SecondaryVlanId.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:c

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

Specifies one or more Hyper-V hosts on which the virtual LAN settings on a virtual machine network adapter are to be configured. 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.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ManagementOS
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

Parameter properties

Type:

PSCredential[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ManagementOS
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Isolated

Specifies Isolated mode for the virtual machine network adapter to be configured. This parameter must be specified in conjunction with parameters PrimaryVlanId and SecondaryVlanId.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:i

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ManagementOS

Specifies the management (e.g. parent or host) operating system.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ManagementOS
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NativeVlanId

Specifies the native virtual LAN identifier for a virtual machine network adapter. This parameter must be specified in conjunction with the switch parameter Trunk.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Passthru

Specifies that a Microsoft.HyperV.PowerShell.VMNetworkAdapterVlanSetting object is to be passed through to the pipeline representing the virtual machine network adapter virtual LAN settings to be configured.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PrimaryVlanId

Specifies the primary virtual LAN identifier for a virtual network adapter in Community, Isolated, or Promiscuous mode.

This parameter must be specified in conjunction with parameter SecondaryVlanId if the virtual machine network adapter is in Community or Isolated mode. It must be used in conjunction with parameter SecondaryVlanIdList if the virtual machine network adapter is in Promiscuous mode.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Promiscuous

Specifies Promiscuous mode for the virtual machine network adapter.

This parameter must be specified in conjunction with parameters PrimaryVlanId and SecondaryVlanIdList.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:p

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SecondaryVlanId

Specifies the secondary virtual LAN identifier for a virtual network adapter in Community or Isolated mode.

This parameter must be specified in conjunction with parameter PrimaryVlanId, along with switch parameter Community or Isolated.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SecondaryVlanIdList

Specifies a list of private virtual LAN secondary virtual LANs on a virtual machine network adapter.This parameter must be specified in conjunction with parameter PrimaryVlanId and switch parameter Promiscuous.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Trunk

Specifies Trunk mode for the virtual machine network adapter. This parameter configures a tagged virtual port that passes all allowed VLANId tags to the VM adapter. Traffic with the NativeVLANId is passed untagged to the VM adapter. This parameter must be used in conjunction with parameters AllowedVlanIdList and NativeVlanId.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:t

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Untagged

Specifies Untagged mode for the virtual machine network adapter.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:u

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VlanId

Specifies the virtual LAN identifier of a virtual machine network adapter. This parameter must be specified in conjunction with switch parameter Access.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AccessVlanId

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VM

Specifies the virtual machine.

Parameter properties

Type:

VirtualMachine[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMName

Specifies the name of the virtual machine.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMNetworkAdapter

Specifies the virtual machine network adapter.

Parameter properties

Type:

VMNetworkAdapterBase[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMNetworkAdapterName

Specifies the name of the virtual machine network adapter.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ManagementOS
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
VMObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

None

Default

Microsoft.HyperV.PowerShell.VMNetworkAdapterVlanSetting

If -PassThru is specified.