Hi
When I see the cmdlet "Set-VMHostNetwork", I found that this cmdlet can not set the Subnetmask for esxi host.
So if i want to set the subnetmask for esxi 4.1/4.0 , what should i do?
Ohter Infor :
I know there is a cmdlet "Set-VMHostNetworkAdapter" that can set the portgroup subnetmask.
But i want to set subnetmask for my esxi not for portgroup.
Can you help me?
Thank in advance!
I suspect you mean the Management Network when you mention your ESXi IP addr.
Then you can do for example
$esx = Get-VMHost <hostname> Get-VMHostNetworkadapter -VMHost $esx | where {$_.PortgroupName -eq "Management Network"} | Set-VMHostNetworkAdapter -SubnetMask 255.255.255.0
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you.
But,if i change the PortgroupName from "Management Network" to other name such as "Test Management NW" ,what should i do to to deal this?
You would have to change the name in the comparison.
It's perhaps easier to define the name at the start of the script ?
$pgName = "Management Network" $esx = Get-VMHost <hostname> Get-VMHostNetworkadapter -VMHost $esx | where {$_.PortgroupName -eq $pgName} | Set-VMHostNetworkAdapter -SubnetMask 255.255.255.0
Or if if you mean how to find the console with what ever name you gave it, then you can use the name of the portgroup.
A console always starts with 'vmk'
$esx = Get-VMHost <hostname> Get-VMHostNetworkadapter -VMHost $esx | where {$_.Name -like "vmk*"} | Set-VMHostNetworkAdapter -SubnetMask 255.255.255.0
But this can cause problems if you have more than 1 console portgroup. Both will have the same subnetmask!
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference