Public/Get-TmdsComputerGroup.ps1
function Get-TmdsComputerGroup { [CmdletBinding(DefaultParameterSetName = 'All')] [Alias('')] param ( [parameter(ParameterSetName = 'All')] [switch]$All, [parameter( ParameterSetName = 'ById', ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Alias('Id')] [int[]]$ComputerGroupId ) process { If ($PSCmdlet.ParameterSetName -eq 'ById') { foreach ($id in $ComputerGroupId) { $Resource = "computergroups/$id" $params = @{ 'Resource' = $Resource 'Method' = "Get" } Invoke-TmdsApiCall @params } } Else { $Resource = "computergroups" $params = @{ 'Resource' = $Resource 'Method' = "Get" } (Invoke-TmdsApiCall @params).computergroups } } } |