Grant-SCMACAddress
Allocates the next available physical address (MAC address) from a MAC address pool, and assigns it to a virtual network adapter.
Syntax
Default (Default)
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.
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 |
-Description
Specifies a description for the MAC address.
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 |
-JobVariable
Specifies a variable in which job progress is tracked and stored.
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 |
-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"
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 |
-MACAddressPool
Specifies a MAC address pool.
Parameter properties
Type: | MACAddressPool |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | Guid |
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 |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
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 |
-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.
Parameter properties
Type: | VirtualNetworkAdapter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-VMMServer
Specifies a VMM (Virtual Machine Manager) server object.
Parameter properties
Type: | ServerConnection |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | True |
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
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.