Well, I had a typo and have it working now. Interestingly enough, this is built into the vCloud PowerCLI Commandlet's, so not sure if one can use that on regular vSphere or not, but here's the function I came up with based on your code.
function New-IPPool
{
<#
.SYNOPSIS
Describe the function here
.DESCRIPTION
Describe the function in more detail
.EXAMPLE
Give an example of how to use it
.EXAMPLE
Give another example of how to use it
.PARAMETER computername
The computer name to query. Just one.
.PARAMETER logname
The name of a file to write failed computer names to. Defaults to errors.txt.
#>
[CmdletBinding(SupportsShouldProcess=$True,ConfirmImpact='High')]
param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The name of the Datacenter the IP Pool will live in')]
[string]$dataCenter,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The name of the new IP Pool')]
[string]$poolName,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The Subnet Mask of the network')]
[string]$poolSubnet,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The Network Address of the new IP Pool')]
[string]$poolNetwork,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The gateway of the new IP Pool')]
[string]$poolGateway,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The start address of the new IP Pool')]
[string]$poolRangeStart,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The size of the IP range of the new IP Pool')]
[string]$poolRangeNum,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage='The Portgroup Association of the new IP Pool')]
[string]$poolAssociatedPortGroup
)
begin
{
}
process
{
$dcSelection = Get-Datacenter -Name $dataCenter
$dc = $dcSelection.ExtensionData.MoRef
$pool = New-Object Vmware.Vim.IpPool
$pool.Name = $poolName
$pool.ipv4Config = New-Object vmware.Vim.IpPoolIpPoolConfigInfo
$pool.ipv4Config.subnetAddress = $poolNetwork
$pool.ipv4Config.netmask = $poolSubnet
$pool.ipv4Config.gateway = $poolGateway
$pool.ipv4Config.range = $poolRangeStart + "#" + $poolRangeNum
$pool.ipv4Config.dhcpServerAvailable = $false
$pool.ipv4Config.ipPoolEnabled = $true
$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 = $poolAssociatedPortGroup
$pool.networkAssociation[0].networkName = ""
$PoolManager = Get-View -Id 'IpPoolManager-IpPoolManager'
$PoolManager.CreateIpPool($dc, $pool)
}
}