Partager via


Set-SCVirtualNetworkAdapter

Set-SCVirtualNetworkAdapter

Changes properties of a virtual network adapter.

Syntax

Parameter Set: IsCheckpoint
Set-SCVirtualNetworkAdapter [[-VirtualNetworkAdapter] <VirtualNetworkAdapter> ] -Checkpoint -VirtualNetwork <String> [-JobVariable <String> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VLanEnabled <Boolean]> ] [-VLanID <UInt16> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: SlotIdSpecified
Set-SCVirtualNetworkAdapter -JobGroup <Guid]> -SlotID <Int32]> [-EnableGuestIPNetworkVirtualizationUpdates <Boolean> ] [-EnableMACAddressSpoofing <Boolean> ] [-EnableVMNetworkOptimization <Boolean> ] [-IPv4AddressType <EthernetAddressType> {Dynamic | Static} ] [-IPv6AddressType <EthernetAddressType> {Dynamic | Static} ] [-JobVariable <String> ] [-LogicalNetwork <LogicalNetwork> ] [-MACAddress <String> ] [-MACAddressType <String> ] [-NetworkLocation <String> ] [-NetworkTag <String> ] [-NoConnection] [-NoLogicalNetwork] [-NoPortClassification] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PortACL <PortACL> ] [-PortClassification <PortClassification> ] [-PROTipID <Guid]> ] [-RemovePortACL] [-RequiredBandwidth <Decimal> ] [-RunAsynchronously] [-VirtualNetwork <String> ] [-VLanEnabled <Boolean]> ] [-VLanID <UInt16> ] [-VMMServer <ServerConnection> ] [-VMNetwork <VMNetwork> ] [-VMNetworkServiceSetting <String> ] [-VMSubnet <VMSubnet> ] [-VMwarePortGroup <String> ] [ <CommonParameters>]

Parameter Set: VirtualNicSpecified
Set-SCVirtualNetworkAdapter [-VirtualNetworkAdapter] <VirtualNetworkAdapter> [-EnableGuestIPNetworkVirtualizationUpdates <Boolean> ] [-EnableMACAddressSpoofing <Boolean> ] [-EnableVMNetworkOptimization <Boolean> ] [-IPv4Addresses <List`1> ] [-IPv4AddressPools <List`1> ] [-IPv4AddressType <EthernetAddressType> {Dynamic | Static} ] [-IPv6Addresses <List`1> ] [-IPv6AddressPools <List`1> ] [-IPv6AddressType <EthernetAddressType> {Dynamic | Static} ] [-JobGroup <Guid]> ] [-JobVariable <String> ] [-LogicalNetwork <LogicalNetwork> ] [-MACAddress <String> ] [-MACAddressType <String> ] [-NetworkLocation <String> ] [-NetworkTag <String> ] [-NoConnection] [-NoLogicalNetwork] [-NoPortClassification] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PortACL <PortACL> ] [-PortClassification <PortClassification> ] [-PROTipID <Guid]> ] [-RemovePortACL] [-RequiredBandwidth <Decimal> ] [-RunAsynchronously] [-VirtualNetwork <String> ] [-VLanEnabled <Boolean]> ] [-VLanID <UInt16> ] [-VMMServer <ServerConnection> ] [-VMNetwork <VMNetwork> ] [-VMNetworkServiceSetting <String> ] [-VMSubnet <VMSubnet> ] [-VMwarePortGroup <String> ] [ <CommonParameters>]

Detailed Description

The Set-SCVirtualNetworkAdapter cmdlet changes one or more properties of a virtual network adapter associated with a virtual machine, virtual machine template, or hardware profile used to create virtual machines in a Virtual Machine Manager (VMM) environment.

Properties you can change include the following:

-- Connect a virtual network adapter to a virtual network.
-- Disconnect a virtual network adapter from a virtual network.
-- Specify a network location and network tag on a virtual network adapter.
-- Specify a MAC address on the virtual network adapter.
-- Enable the use of a virtual local area network (VLAN) and specify a VLAN ID (numerical identifier) for that VLAN on the virtual network adapter.

Parameters

-Checkpoint

Specifies the Can Checkpoint permission.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableGuestIPNetworkVirtualizationUpdates<Boolean>

Indicates whether IP network virtualization updates by a guest is enabled.

Aliases

GuestIPNetworkVirtualizationUpdatesEnabled

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableMACAddressSpoofing<Boolean>

Indicates whether to enable, when set to $True, MAC Address spoofing.

Aliases

MACAddressesSpoofingEnabled

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableVMNetworkOptimization<Boolean>

Indicates whether to enable, when set to $True, virtual machine network optimization. This feature improves network performance for virtual machines with network adapters that support virtual machine queue (VMQ) or TCP Chimney Offload. VMQ enables creating a unique network queue for each virtual network adapter. TCP Chimney Offload enables network traffic processing to be offloaded from the networking stack.

Aliases

VMNetworkOptimizationEnabled

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPv4Addresses<List`1>

Specifies a list of IPv4 addresses.

Aliases

IPv4Address

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPv4AddressPools<List`1>

Specifies a list of IPv4 address pools.

Aliases

IPv4AddressPool

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPv4AddressType<EthernetAddressType>

Specifies an IPv4 address type.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPv6Addresses<List`1>

Specifies a list of IPv6 addresses.

Aliases

IPv6Address

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPv6AddressPools<List`1>

Specifies a list of IPv6 address pools.

Aliases

IPv6AddressPool

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPv6AddressType<EthernetAddressType>

Specifies an IPv6 address type.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobGroup<Guid]>

Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LogicalNetwork<LogicalNetwork>

Specifies a logical network. A logical network is a named grouping of IP subnets and VLANs that is used to organize and simplify network assignments.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MACAddress<String>

Specifies the Media Access Control (MAC) address, or a set of MAC addresses, for a physical or virtual network adapter on a computer. Valid values are: one or more MAC addresses.

Example format for a single MAC address:

-MACAddress "00-15-5D-B4-DC-00"

Example format for a set of MAC addresses:

-MACAddress "00-15-5D-B4-DC-00", "00-1A-A0-E3-75-29"

Example format for a set of MAC addresses:

$Macs = "00-15-5D-B4-DC-00", "00-1A-A0-E3-75-29"

Set-SCPXEServer –MACAddress $Macs

NOTE: When used with New-SCPXEServer or Set-SCPXEServer, the MACAddress parameter updates the PXE interfaces from which the SCDM PXE Server listens for and responds to PXE requests.

Aliases

EthernetAddress,PhysicalAddress

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MACAddressType<String>

Specifies the type of MAC address to use for a virtual network adapter. Valid values are: Static, Dynamic.

Aliases

EthernetAddressType,PhysicalAddressType

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NetworkLocation<String>

Specifies the network location for a physical network adapter or for a virtual network adapter, or changes the default network location of a host's physical network adapter.

Example formats:

-NetworkLocation $NetLoc ($NetLoc might contain "Corp.Contoso.com")

-OverrideNetworkLocation $TRUE -NetworkLocation "HostNICNewLocation.Contoso.com"

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NetworkTag<String>

Specifies a word or phrase to associate with a virtual network adapter that is configured to connect to a specific internal or external network on the host. The NetworkTag identifies all virtual machines with the same NetworkTag as members of the same network. VMM uses a NeworkTag (if one exists) when it evaluates hosts as possible candidates on which to deploy a virtual machine. If the host does not include virtual machines on the network with the same NetworkTag as the virtual machine to be placed, the host receives zero stars in the placement process.

Aliases

Tag

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NoConnection

Disconnects a virtual network adapter from a virtual network.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NoLogicalNetwork

Indicates that no logical network is associated with this virtual network adapter.

Aliases

NoVMNetwork

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NoPortClassification

Indicates that a port classification is not provided.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUser<System.String>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PortACL<PortACL>

Specifies a port Access Control List (ACL) value that this cmdlet assigns to the Virtual Network Adapter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PortClassification<PortClassification>

Specifies the port classification of the switch to which the virtual network adapter connects.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RemovePortACL

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RequiredBandwidth<Decimal>

Specifies the network bandwidth required by a network adapter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SlotID<Int32]>

Specifies a numerical ID used to identify a device.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VirtualNetwork<String>

Specifies a virtual network object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VirtualNetworkAdapter<VirtualNetworkAdapter>

Specifies a virtual network adapter object for a virtual machine. The number of virtual adapters for each type of host are:

-- Hyper-V: Up to four emulated adapters per virtual machine, and up to eight synthetic adapters per virtual machine. No driver is available for an emulated network adapter on a Windows Server 2003 x64 guest.
-- VMware ESX: Up to four emulated adapters per virtual machine.
-- Citrix XenServer: Up to seven emulated adapters per virtual machine.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VLanEnabled<Boolean]>

Indicates whether the cmdlet enables a virtual LAN (VLAN) for use by virtual machines on a Hyper-V or Citrix XenServer host.

Example format for a single VLAN: -VLanEnabled $True -VLanMode "Access" -VLanID 35

Example format for multiple VLANs: -VLanEnabled $True -VLanMode "Trunk" -VLanTrunkID 1,2,100,200,1124

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VLanID<UInt16>

Assigns a numerical identifier in the range 1-4094 to a virtual network adapter on a virtual machine or to a physical network adapter on a virtual machine host.

Configure a VLanID on a Hyper-V, VMware ESX, or Citrix XenServer host:

-- On an externally bound physical network adapter when the VLan mode is Access.

Configure a VLanID on a virtual network adapter of a virtual machine:

-- Bound to a physical network adapter on the host, or
-- Bound to an internal virtual network on the host.

Example format: -VLanEnabled $True -VLanMode "Access" -VLanID 35

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMNetwork<VMNetwork>

Specifies a VM network object.

To get a VM network object, use the Get-SCVMNetwork cmdlet.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMNetworkServiceSetting<String>

Specifies a VM network service setting.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMSubnet<VMSubnet>

Specifies a VM subnet object.

To obtain a VM subnet object, use the Get-SCVMSubnet cmdlet.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMwarePortGroup<String>

Specifies the VMware port group.

Aliases

none

Required?

false

Position?

named

Default Value

none

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.

  • VirtualNetworkAdapter

Notes

  • This cmdlet requires a VMM virtual network adapter object, which can be retrieved by using the Get-SCVirtualNetworkAdapter cmdlet.

Examples

Example 1: Connect a virtual network adapter to a virtual network

The first command gets the virtual machine object named VM01, and then stores the object in the $VM variable.

The second command gets all virtual network adapter objects on VM01, selects the adapter object with the MAC address of 00:16:D3:CC:00:1B, and then stores the object in the $Adapter variable.

The last command connects the virtual network adapter stored in $Adapter to the virtual network named ExternalVirtualNetwork01 on the host that contains VM01.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> $Adapter = Get-SCVirtualNetworkAdapter -VM $VM | where { $_.PhysicalAddress -eq "00:16:D3:CC:00:1B" }
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapter -VirtualNetwork "ExternalVirtualNetwork01"

Example 2: Specify a static MAC address for a virtual network adapter

The first command gets the virtual machine object named VM02, and then stores the object in the $VM variable.

The second command gets all virtual network adapter objects on VM02, selects the virtual network adapter with the specified ID, and then stores the object in the $Adapter variable. This example assumes that this adapter currently has a dynamic MAC address.

The last command specifies that the virtual network adapter stored in $Adapter use the static MAC address 00:16:D3:CC:00:1C.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM02"
PS C:\> $Adapter = Get-SCVirtualNetworkAdapter -VM $VM | where { $_.ID -eq "5c0ee80a-731f-41c8-92f0-85a1619f9a1b" }
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapter -PhysicalAddressType "Static" -PhysicalAddress "00:16:D3:CC:00:1C"

Example 3: Specify a static MAC address and assign it to an existing virtual network adapter

The first command gets the virtual machine object named VM03, and then stores the object in the $VM variable.

The second command gets the virtual network adapter object on VM03 by ID, specifies that the adapter uses a static MAC address type, and assigns it a MAC address.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM03"
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter (Get-VirtualNetworkAdapter -VM $VM | where { $_.ID -eq "95e9cfda-861c-44a3-b2ba-2f796dfe691c"}) -MACAddressType "Static" -MACAddress "00-00-00-00-00-00"

Example Example 4:. Disconnect the specified virtual network adapter from the virtalvirtual network.:virtual

The first command gets the virtual machine object named VM04, and then stores the object in the $VM variable.

The second command gets all virtual network adapter objects on VM04, and then stores the adapter objects in $Adapters. This example assumes that VM04 has at least 2 virtual network adapters.

The last command uses the NoConnection parameter to disconnect the second virtual network adapter, Adapters[1], from any virtual network that it is connected to.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM04"
PS C:\> $Adapters = Get-SCVirtualNetworkAdapter -VM $VM
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapters[1] -NoConnection

Example 5: Specify a VMware port group for an existing virtual machine

The first command gets the virtual machine object named VM05, and then stores the object in the $VM variable.

The second command stores the first [0] virtual network adapter on VM05 in the $Adapter variable.

The last command sets the virtual network adapter for the adapter stored in $Adapter to Virtual Machine Network. Virtual Machine Network is the name of the VMware port group that you want this adapter to connect to.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM05"
PS C:\> $Adapter = $VM.VirtualNetworkAdapters[0]
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapter -VMwarePortGroup "Virtual Machine Network" 

Add-SCVMHostNetworkAdapter

Get-SCVirtualNetwork

Get-SCVirtualNetworkAdapter

New-SCVirtualNetwork

New-SCVirtualNetworkAdapter

Remove-SCVirtualNetworkAdapter

Set-SCVirtualNetwork

Set-SCVMHostNetworkAdapter