Reply to Message

View discussion in a popup

Replying to:
flynmooney
Enthusiast
Enthusiast

The "RefreshNetworkSystem" call did not fix the mac but it led me to going through the network members again and I found "UpdateVirtualNic" which worked like a charm.  Code snip below.  Thanks for the help.

Variables needed:

$ipaddress

$esxcred

$mac

Connect-VIServer $ipaddress -credential $esxcred

$esxhost = Get-VMHost

$hostview = $esxhost | Get-View

$net = Get-View -Id $hostview.configmanager.networksystem

$vnic = $net.networkinfo.vnic | ? { $_.device -eq "vmk0" }
$spec = $vnic.spec

$spec.mac = $mac

$net.UpdateVirtualNic("vmk0",$spec)

disconnect-viserver * -confirm:$false

View solution in original post

Reply
0 Kudos