Hello
I need to bulk add vmkernel ports to esxi
csv file
esxi mgmt ip /esxi-vmkernel-name/vmkernelIP
can someone help
Thanks
Try like this
# Following info is in the CSV
#
# 'VMHost','Switch','Port','IP','Mask'
# 'esx1','switch1','100','192.168.0.50','255.255.255.0'
#
Import-Csv vmkernel.csv -UseCulture | %{
$myVMHost = Get-VMHost -Name $_.VMHost
$myVDSwitch = Get-VDSwitch -Name $_.Switch
New-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -PortId $_.Port -IP $_.IP -SubnetMask $_.Mask
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This can easily be done with the New-VMHostNetworkAdapter cmdlet,
But you need more information in the CSV, like for example the vSwitch where the VMKernel needs to be created.
Can you perhaps show us some sample lines from the CSV you will be using?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
my case is
Creates a new VMKernel network adapter and connects it to the specified port group on the specified distributed switch.
-------------- Example 8 --------------
$myVMHost = Get-VMHost -Name "MyVMHost"
$myVDSwitch = Get-VDSwitch -Name "MyVDSwitch"
New-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -PortId 100 -IP 192.168.0.50 -SubnetMask 255.255.255.0
So here the ip will be specific for each node ..
Try like this
# Following info is in the CSV
#
# 'VMHost','Switch','Port','IP','Mask'
# 'esx1','switch1','100','192.168.0.50','255.255.255.0'
#
Import-Csv vmkernel.csv -UseCulture | %{
$myVMHost = Get-VMHost -Name $_.VMHost
$myVDSwitch = Get-VDSwitch -Name $_.Switch
New-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -PortId $_.Port -IP $_.IP -SubnetMask $_.Mask
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference