Set-SCVirtualNetworkAdapter

Changes properties of a virtual network adapter associated with a virtual machine, a virtual machine template, or a hardware profile used to create virtual machines in VMM.

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 System Center 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.

For more information about Set-SCVirtualNetworkAdapter, type: "Get-Help Set-SCVirtualNetworkAdapter -online".

Parameters

EnableMACAddressSpoofing

Required? false
Accept Pipeline Input? false
Position? named
Enables, when set to $True, MAC Address spoofing.

EnableVMNetworkOptimization

Required? false
Accept Pipeline Input? false
Position? named
Enables, 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.

IPv4AddressType

Required? false
Accept Pipeline Input? false
Position? named
Specifies an IPv4 address type.

IPv6AddressType

Required? false
Accept Pipeline Input? false
Position? named
Specifies an IPv6 address type.

JobGroup

Required? false
Accept Pipeline Input? false
Position? named
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. 

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

LogicalNetwork

Required? false
Accept Pipeline Input? false
Position? named
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.

MACAddress

Required? false
Accept Pipeline Input? false
Position? named
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

MACAddressType

Required? false
Accept Pipeline Input? false
Position? named
Specifies the type of MAC address to use for a virtual network adapter. Valid values are: Static, Dynamic.

NetworkLocation

Required? false
Accept Pipeline Input? false
Position? named
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"

NetworkTag

Required? false
Accept Pipeline Input? false
Position? named
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.

NoConnection

Required? false
Accept Pipeline Input? false
Position? named
Disconnects a virtual network adapter from a virtual network.

NoLogicalNetwork

Required? false
Accept Pipeline Input? false
Position? named
Indicates that no logical network is associated with this virtual network adapter.

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RequiredBandwidth

Required? false
Accept Pipeline Input? false
Position? named
Specifies the network bandwidth required by a network adapter.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 

SlotID

Required? false
Accept Pipeline Input? false
Position? named
Specifies a numerical ID used to identify a device.

VirtualNetwork

Required? false
Accept Pipeline Input? false
Position? named
Specifies a virtual network object.

VLanEnabled

Required? false
Accept Pipeline Input? false
Position? named
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 -VLANMode "Access" -VLANID 35
Example format for multiple VLANs: -VLANEnabled -VLANMode "Trunk"  -VLANTrunkID 1,2,100,200,1124

VLanID

Required? false
Accept Pipeline Input? false
Position? named
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
 -VLanMode "Access" -VLANID 35

VMMServer

Required? false
Accept Pipeline Input? false
Position? named
Specifies a VMM server object.

VMwarePortGroup

Required? false
Accept Pipeline Input? false
Position? named
Specifies the VMware port group.

VirtualNetworkAdapter

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a virtual network adapter object for a virtual machine. 

TYPE OF HOST	NUMBER OF VIRTUAL NETWORK ADAPTERS
------------	----------------------------------
Hyper-V		 Up to 4 emulated adapters per virtual machine.
Up to 8 synthetic adapters per virtual machine.
(Exception: no driver available for an emulated 
network adapter on a Windows Server 2003 x64 guest.)
VMware ESX		Up to 4 emulated adapters per virtual machine.
Citrix XenServer  Up to 7 emulated adapters per virtual machine.

EnableMACAddressSpoofing

Required? false
Accept Pipeline Input? false
Position? named
Enables, when set to $True, MAC Address spoofing.

EnableVMNetworkOptimization

Required? false
Accept Pipeline Input? false
Position? named
Enables, 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.

IPv4AddressType

Required? false
Accept Pipeline Input? false
Position? named
Specifies an IPv4 address type.

IPv6AddressType

Required? false
Accept Pipeline Input? false
Position? named
Specifies an IPv6 address type.

JobGroup

Required? false
Accept Pipeline Input? false
Position? named
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. 

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

LogicalNetwork

Required? false
Accept Pipeline Input? false
Position? named
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.

MACAddress

Required? false
Accept Pipeline Input? false
Position? named
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

MACAddressType

Required? false
Accept Pipeline Input? false
Position? named
Specifies the type of MAC address to use for a virtual network adapter. Valid values are: Static, Dynamic.

NetworkLocation

Required? false
Accept Pipeline Input? false
Position? named
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"

NetworkTag

Required? false
Accept Pipeline Input? false
Position? named
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.

NoConnection

Required? false
Accept Pipeline Input? false
Position? named
Disconnects a virtual network adapter from a virtual network.

NoLogicalNetwork

Required? false
Accept Pipeline Input? false
Position? named
Indicates that no logical network is associated with this virtual network adapter.

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RequiredBandwidth

Required? false
Accept Pipeline Input? false
Position? named
Specifies the network bandwidth required by a network adapter.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 

VirtualNetwork

Required? false
Accept Pipeline Input? false
Position? named
Specifies a virtual network object.

VLanEnabled

Required? false
Accept Pipeline Input? false
Position? named
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 -VLANMode "Access" -VLANID 35
Example format for multiple VLANs: -VLANEnabled -VLANMode "Trunk"  -VLANTrunkID 1,2,100,200,1124

VLanID

Required? false
Accept Pipeline Input? false
Position? named
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
 -VLanMode "Access" -VLANID 35

VMMServer

Required? false
Accept Pipeline Input? false
Position? named
Specifies a VMM server object.

VMwarePortGroup

Required? false
Accept Pipeline Input? false
Position? named
Specifies the VMware port group.
Requires a VMM virtual network adapter object, which can be retrieved by using the Get-SCVirtualNetworkAdapter cmdlet.

Examples

1: Connect a virtual network adapter to a virtual network.
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"
The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second command gets all virtual network adapter objects on VM01, selects the adapter object with the physical (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. 
2: Specify a static MAC address for a virtual network adapter.
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"
The first command gets the virtual machine object named VM02 and 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. 
3: Specify a static MAC address and assign it to an existing virtual network adapter.
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"
The first command gets the virtual machine object named VM03 and 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 MACAddress.
4. Disconnect the specified virtual network adapter from the virtal network.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM04"
PS C:\> $Adapters = Get-SCVirtualNetworkAdapter -VM $VM
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapters[1] -NoConnection
The first command gets the virtual machine object named VM04 and stores the object in the $VM variable.

The second command gets all virtual network adapter objects on VM04 and 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.
5: Specify a VMware port group for an existing virtual machine.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM05"
PS C:\> $Adapter = $VM.VirtualNetworkAdapters[0]
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapter -VMwarePortGroup “VM Network”
The first command gets the virtual machine object named VM05 and 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 "VM Network", which is the name of the VMware port group that you want this adapter to connect to.

See Also