VMware: Set MAC Address of a kernel interface with PowerCli


the New-VMHostNetworkAdapter offers the ability to set the MAC address while adding a new kernel interface. But this has a limitation. It always only a MAC within a range 00:50:56:00:00:00 – 00:50:56:3F:FF:FF.

If you try it even though you will get an error:

New-VMHostNetworkAdapter The MAC address is invalid or is not in the valid range 00:50:56:00:00:00 - 00:50:56:3F:FF:FF.

But its possible. Use the following code

# Get Host
$oESXiHost=Get-VMHost $sESXIHost
$oHostIpConfig=new-object VMware.Vim.HostIpConfig
$oHostNicSpec=new-object VMware.Vim.HostVirtualNicSpec
$oHostNetworkSystem=get-view -id $oESXiHost.ExtensionData.ConfigManager.Networksystem
$oHostNetworkSystem.UpdateVirtualNic($sNICToChange ,$oHostNicSpec)		


Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.