Public/Get-fpWorkerCount.ps1
function Get-fpWorkerCount { [CmdletBinding()] param( [Parameter(ValueFromPipeline,ValueFromPipelineByPropertyName)] [ValidateSet("XCH","ETH")] [string[]]$CoinTicker = @("XCH","ETH") ) Process{ foreach ($coin in $CoinTicker){ try{ $Query = "pool/workerCount?coin=$coin" $Results = Invoke-FlexPoolAPI -Query $Query if ($null -eq $Results.error){ [PSCustomObject]@{ Coin = $coin WorkerCount = $Results.Result } } else{ Write-Error $Results.error -ErrorAction Stop } } catch{ $PSCmdlet.WriteError($_) } #try/catch } #foreach coin } #Process } |