function Remove-Address { [CmdletBinding(DefaultParameterSetName="ByID")] param ( [parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0,ParameterSetName="ByID")] [ValidateNotNullOrEmpty()] [int] $Id, [parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByAddressObject")] [ValidateNotNullOrEmpty()] [PS.IPAM.Address] $AddressObject ) process { $_params = @{ Controller = [PS.IPAM.controllers]::addresses Method = "DELETE" } switch ($PSCmdlet.ParameterSetName) { "ByID" { $_identifiers = @($Id);break } "ByAddressObject" { $_identifiers = @($AddressObject.Id);break } } $_params.Add("Identifiers",$_identifiers) Invoke-Request @_params } } Export-ModuleMember Remove-Address