functions/discovery/Get-TssDiscoverySourceAvailableScanner.ps1
|
function Get-TssDiscoverySourceAvailableScanner { <# .SYNOPSIS Get the scanners that can be added to a discovery source .DESCRIPTION Lists the scanners that can be added to a discovery source, with the scan type of each and whether it is suggested for the source. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Discovery source ID .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssDiscoverySourceAvailableScanner -TssSession $session -Id 3 | Where-Object IsSuggested List the suggested scanners for discovery source 3 .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/discovery/Get-TssDiscoverySourceAvailableScanner .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/discovery/Get-TssDiscoverySourceAvailableScanner.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Discovery.SourceAvailableScanner[]')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('DiscoverySourceId')] [int[]] $Id ) begin { $tssParams = $PSBoundParameters $invokeParams = . $GetInvokeApiParams $TssSession } process { Get-TssInvocation $PSCmdlet.MyInvocation if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { Compare-TssVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation foreach ($currentId in $Id) { $restResponse = $null $uri = $TssSession.ApiUrl, 'discovery', 'source', $currentId, 'available-scanners' -join '/' $invokeParams.Uri = $uri $invokeParams.Method = 'GET' Write-Verbose "Performing the operation $($invokeParams.Method) $uri" try { $apiResponse = Invoke-TssApi @invokeParams $restResponse = . $ProcessResponse $apiResponse } catch { Write-Warning 'Issue with Get-TssDiscoverySourceAvailableScanner request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.Discovery.SourceAvailableScanner[]](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.Discovery.SourceAvailableScanner])) } } } else { Write-Warning 'No valid session found' } } } |