VMware Cloud Community
complex
Contributor
Contributor

setting "Management" flag on VMHostNetworkAdapter - ESXi

Is there a way to set the "Management traffic" flag on a VMHostNetwork Port? I am working on a PowerCLI script to turnup some new ESXi hosts.

I already have something like New-VMHostNetworkAdapter -PortGroup "vMotion" -VirtualSwitch "vSwitch2" -IP 10.112.138.32 -SubnetMask 255.255.255.0 -VMotionEnabled:$true

but is there something like -ManagementEnable:$true to turn on the Management traffic checkbox that the GUI has?

Tags (2)
0 Kudos
4 Replies
complex
Contributor
Contributor

I think I found the solution. You need to use Get-View -Property configmanager, then VirtualNicManager from that, then use SelectVnicForNicType ("management", "vmk1")

0 Kudos
shuisman
Contributor
Contributor

I'm trying to do the same thing but when I follow your instructions the command error's out. Can you please let me know exactly how you managed to set the "managment" flag on a network adaptor?

0 Kudos
complex
Contributor
Contributor

$ESX = "esx-01.example.org"
$cm = Get-VMHost $ESX | Get-View -Property configManager
$nicManager = Get-View $cm.ConfigManager.VirtualNicManager
$nicManager.SelectVnicForNicType("management", "vmk1")

Adapted from http://www.rtfm-ed.co.uk/downloads/configureESXi.ps1

Hope this helps.

0 Kudos
shuisman
Contributor
Contributor

Thanks that's very helpful. Everything works but unfortunately on HP servers it doesn't give any information about serial number, just asset tag and that's manually entered in the BIOS.

Thanks,

Scott

0 Kudos