Set-SCVirtualNetworkAdapter
Applies To: System Center 2012 - Virtual Machine Manager
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.
Syntax
Parameter Set: SlotIdSpecified
Set-SCVirtualNetworkAdapter -JobGroup <Guid> -SlotID <Int32> [-EnableMACAddressSpoofing <Boolean> ] [-EnableVMNetworkOptimization <Boolean> ] [-IPv4AddressType <EthernetAddressType> ] [-IPv6AddressType <EthernetAddressType> ] [-JobVariable <String> ] [-LogicalNetwork <LogicalNetwork> ] [-MACAddress <String> ] [-MACAddressType <String> ] [-NetworkLocation <String> ] [-NetworkTag <String> ] [-NoConnection] [-NoLogicalNetwork] [-PROTipID <Guid> ] [-RequiredBandwidth <Decimal> ] [-RunAsynchronously] [-VirtualNetwork <String> ] [-VLanEnabled <Boolean> ] [-VLanID <UInt16> ] [-VMMServer <ServerConnection> ] [-VMwarePortGroup <String> ] [ <CommonParameters>]
Parameter Set: VirtualNicSpecified
Set-SCVirtualNetworkAdapter [-VirtualNetworkAdapter] <VirtualNetworkAdapter> [-EnableMACAddressSpoofing <Boolean> ] [-EnableVMNetworkOptimization <Boolean> ] [-IPv4AddressType <EthernetAddressType> ] [-IPv6AddressType <EthernetAddressType> ] [-JobGroup <Guid> ] [-JobVariable <String> ] [-LogicalNetwork <LogicalNetwork> ] [-MACAddress <String> ] [-MACAddressType <String> ] [-NetworkLocation <String> ] [-NetworkTag <String> ] [-NoConnection] [-NoLogicalNetwork] [-PROTipID <Guid> ] [-RequiredBandwidth <Decimal> ] [-RunAsynchronously] [-VirtualNetwork <String> ] [-VLanEnabled <Boolean> ] [-VLanID <UInt16> ] [-VMMServer <ServerConnection> ] [-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 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<Boolean>
Enables, when set to $True, MAC Address spoofing.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-EnableVMNetworkOptimization<Boolean>
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.
Aliases |
none |
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? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-IPv6AddressType<EthernetAddressType>
Specifies an IPv6 address type.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
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 |
none |
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 |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
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 |
none |
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 |
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 |
-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? |
false |
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.
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.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-VLanEnabled<Boolean>
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
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
-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 |
-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.
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
- 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.
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.
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"
2: Specify a static MAC address for a virtual network adapter.
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.
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"
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 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.
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"
4. Disconnect the specified virtual network adapter from the virtal network.
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.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM04"
PS C:\> $Adapters = Get-SCVirtualNetworkAdapter -VM $VM
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapters[1] -NoConnection
5: Specify a VMware port group for an existing virtual machine.
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.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM05"
PS C:\> $Adapter = $VM.VirtualNetworkAdapters[0]
PS C:\> Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapter -VMwarePortGroup "VM Network"