Grant-SCMACAddress

Allocates the next available physical address (MAC address) from a MAC address pool, and assigns it to a virtual network adapter.

Syntax

Grant-SCMACAddress
     [-VMMServer <ServerConnection>]
     [-MACAddress <String>]
     -MACAddressPool <MACAddressPool>
     -VirtualNetworkAdapter <VirtualNetworkAdapter>
     [-Description <String>]
     [-RunAsynchronously]
     [-PROTipID <Guid>]
     [-JobVariable <String>]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]

Description

The Grant-SCMACAddress cmdlet allocates the next available physical address, specified as a Media Access Control (MAC) address from a MAC address pool and assigns it to a virtual network adapter. To allocate a specific MAC address, use the MACAddress parameter.

For information about creating MAC address pools, type: New-SCMACAddressPool -Detailed.

Examples

Example 1: Allocate a MAC address from a MAC address Pool and assign it to a virtual network adapter

PS C:\> $VM = Get-SCVirtualMachine -VMHost "VMHost01.Contoso.com" -Name "VM01"
PS C:\> $VNIC = Get-SCVirtualNetworkAdapter -VM $VM
PS C:\> $HostGroup = Get-SCVMHostGroup | where { $_.Path -eq "All Hosts\HostGroup02\Production" }
PS C:\> $MACAddressPool = Get-SCMACAddressPool -VMHostGroup $HostGroup -Name "MAC Address Pool 01"
PS C:\> Grant-SCMACAddress -MACAddressPool $MACAddressPool -VirtualNetworkAdapter $VNIC

The first command gets the virtual machine object named VM01 on host VMHost01 and stores the object in the $VM variable.

The second command gets the virtual network adapter object for the virtual machine stored in $VM and stores the object in the $VNIC variable. This example assumes that the virtual machine has only one virtual network adapter.

The third command gets the host group object at the path All Hosts\HostGroup02\Production and stores the object in the $HostGroup variable.

The fourth command gets the MAC address pool associated with the host group stored in $HostGroup and named MAC Address Pool 01.

The last command assigns a MAC address to the virtual network adapter stored in $VNIC.

Example 2: Allocate a MAC address from a MAC address Pool and assign it to a specific virtual network adapter

PS C:\> $VM = Get-SCVirtualMachine -Name "VM02"
PS C:\> $VNIC = Get-SCVirtualNetworkAdapter -VM $VM | where {$_.SlotId -eq 1}
PS C:\> $MACAddressPool = Get-SCMACAddressPool -Name "MAC Address Pool 02"
PS C:\> Grant-SCMACAddress -MACAddressPool $MACAddressPool -VirtualNetworkAdapter $VNIC

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

The second command gets the virtual network adapter object for VM02 with the slot ID of 1 and stores the object in the $VNIC variable.

The third command gets the MAC address Pool named MAC Address Pool 02 and stores the object in the the $MACAddressPool variable.

The last command grants a MAC address from MAC Address Pool 02 to the virtual network adapter stored in $VNIC.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Description

Specifies a description for the MAC address.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-JobVariable

Specifies a variable in which job progress is tracked and stored.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MACAddress

Specifies the MAC address, or a set of MAC addresses, for a physical or virtual network adapter on a computer.

  • 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"
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MACAddressPool

Specifies a MAC address pool.

Type:MACAddressPool
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Type:Guid
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.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VMMServer

Specifies a VMM (Virtual Machine Manager) server object.

Type:ServerConnection
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-VirtualNetworkAdapter

Specifies a virtual network adapter object for a virtual machine.

The maximum number of virtual network adapters varies by the type of host. If the host type is Hyper-V, the maximum number of virtual network adapters is:

  • Up to four emulated adapters per virtual machine.
  • Up to eight synthetic adapters per virtual machine. An exception is that no driver is available for an emulated network adapter on a Windows Server 2003 x64 guest.

If the host type is VMware ESX:

  • Up to four emulated adapters per virtual machine.

If the host type is Citrix XenServer:

  • Up to seven emulated adapters per virtual machine.
Type:VirtualNetworkAdapter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

CloudPairing[]

This cmdlet returns an array of CloudPairing objects.

Notes

  • Requires a VMM MACAddressPool object, which can be retrieved using the Get-SCMACAddressPool cmdlet, and a VMM virtual network adapter object, which can be retrieved using the Get-SCVirtualNetworkAdapter cmdlet.