VMware Cloud Community
Gummadip
Contributor
Contributor

Add ESXi Routs to Multiple host or esxi cluster using powershell

how to add ESXi routs using the power shell on multiple hosts or a esxi cluster Connecting to vCenter 

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot

you can try as below

Get-VMHost -PipelineVariable esx | ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $esx -V2
$parms = @{
  network = '192.168.102.0/24'
  gateway = '192.168.3.1'
}
$esxcli.network.ip.route.ipv4.add.Invoke($parms)
$esxcli.network.ip.route.ipv4.list.Invoke()
}

Reply
0 Kudos