Share via


Grant-SCMACAddress

Grant-SCMACAddress

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

Syntax

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

Detailed Description

The Grant-SCMACAddress cmdlet allocates the next available physical address (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".

Parameters

-Description<String>

States a description for the specified object.

Aliases

none

Required?

false

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

-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

-MACAddressPool<MACAddressPool>

Specifies a MAC address pool.

Aliases

none

Required?

true

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

-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

-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?

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

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.

  • CloudPairing[]

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.

Examples

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

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.

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

2: Allocate a MAC address from a MAC address Pool and assign it to a specific 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 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.

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

Get-SCMACAddress

Get-SCMACAddressPool

Revoke-SCMACAddress