Datacenter objects have a tab "IP Pools" to create IP pools for vApps (as I understand it). How can IP pools be created or modified using PowerCLI?
Asked
Active
Viewed 327 times
1 Answers
0
There is no dedicated cmdlet for this but I have done it with Get-View before, here is the sample code I used at the time, it needs adjusting to work but you get the point
$dc = New-Object VMware.Vim.ManagedObjectReference
$dc.type = "Datacenter"
$dc.Value = "datacenter-2"
$pool = New-Object VMware.Vim.IpPool
$pool.name = "MyIPPool"
$pool.ipv4Config = New-Object VMware.Vim.IpPoolIpPoolConfigInfo
$pool.ipv4Config.subnetAddress = "192.168.1.0"
$pool.ipv4Config.netmask = "255.255.255.0"
$pool.ipv4Config.gateway = "192.168.1.1"
$pool.ipv4Config.range = "192.168.1.10#1"
$pool.ipv4Config.dns = New-Object System.String[] (1)
$pool.ipv4Config.dns[0] = ""
$pool.ipv4Config.dhcpServerAvailable = $false
$pool.ipv4Config.ipPoolEnabled = $true
$pool.ipv6Config = New-Object VMware.Vim.IpPoolIpPoolConfigInfo
$pool.ipv6Config.subnetAddress = ""
$pool.ipv6Config.netmask = "ffff:ffff:ffff:ffff:ffff:ffff::"
$pool.ipv6Config.gateway = ""
$pool.ipv6Config.dns = New-Object System.String[] (1)
$pool.ipv6Config.dns[0] = ""
$pool.ipv6Config.dhcpServerAvailable = $false
$pool.ipv6Config.ipPoolEnabled = $false
$pool.dnsDomain = ""
$pool.dnsSearchPath = ""
$pool.hostPrefix = ""
$pool.httpProxy = ""
$pool.networkAssociation = New-Object VMware.Vim.IpPoolAssociation[] (1)
$pool.networkAssociation[0] = New-Object VMware.Vim.IpPoolAssociation
$pool.networkAssociation[0].network = New-Object VMware.Vim.ManagedObjectReference
$pool.networkAssociation[0].network.type = "DistributedVirtualPortgroup"
$pool.networkAssociation[0].network.Value = "dvportgroup-178"
$pool.networkAssociation[0].networkName = ""
$PoolManager = Get-View -Id 'IpPoolManager-IpPoolManager'
$PoolManager.CreateIpPool($dc, $pool)

Alan
- 1
-
Ta. I'll try that out. – Andrew J. Brehm Jan 15 '14 at 18:57