functions/discovery/Get-TssDiscoverySourceStub.ps1
|
function Get-TssDiscoverySourceStub { <# .SYNOPSIS Get the default settings of a new discovery source .DESCRIPTION Gets a discovery source populated with the default values of a source type, as a starting point for a new source. Nothing is created. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Discovery source type ID: 1 Unix, 2 ODBC, 3 FileLoad, 4 ManualInput, 5 ESX, 6 ActiveDirectory, 7 PowerShell, 9 AmazonWebService, 10 GoogleCloudProvider, 11 EntraId .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssDiscoverySourceStub -TssSession $session -Id 6 Get the default settings of a new Active Directory discovery source .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/discovery/Get-TssDiscoverySourceStub .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/discovery/Get-TssDiscoverySourceStub.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Discovery.Source')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('TypeId')] [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', 'stub', $currentId -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-TssDiscoverySourceStub request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.Discovery.Source](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.Discovery.Source])) } } } else { Write-Warning 'No valid session found' } } } |