function Get-Section { [CmdletBinding(DefaultParameterSetName="NoParams")] [OutputType([PS.IPAM.Section])] param ( [parameter( Mandatory=$false, ValueFromPipeline=$true, Position=0, ParameterSetName="ByID" )] [ValidateNotNullOrEmpty()] [int] $Id, [parameter( Mandatory=$true, ValueFromPipeline=$true, Position=0, ParameterSetName="ByName" )] [ValidateNotNullOrEmpty()] [string] $Name ) process { $_params = @{ Controller = [PS.IPAM.controllers]::sections Method = "GET" Type = [PS.IPAM.types]::Section } switch ($PSCmdlet.ParameterSetName) { "ByID" { $_identifiers = @($Id); break } "ByName" { $_identifiers = @($Name); break } } $_params.Add("Identifiers",$_identifiers) Invoke-Request @_params } } Export-ModuleMember Get-Section