functions/discovery/Get-TssDiscoveryAccountRule.ps1
|
function Get-TssDiscoveryAccountRule { <# .SYNOPSIS Get a Discovery account rule .DESCRIPTION Returns the detail of one or more Discovery account rules by id: filters, scan template, secret creation, password and takeover settings. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Discovery account rule id .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssDiscoveryAccountRule -TssSession $session -Id 3 Get the Discovery account rule with id 3 .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Search-TssDiscoveryAccountRule -TssSession $session | Get-TssDiscoveryAccountRule -TssSession $session Get the detail of every active Discovery account rule .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/discovery/Get-TssDiscoveryAccountRule .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/discovery/Get-TssDiscoveryAccountRule.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Discovery.AccountRule')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('RuleId')] [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', 'rules', 'accounts', $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-TssDiscoveryAccountRule request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.Discovery.AccountRule](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.Discovery.AccountRule])) } } } else { Write-Warning 'No valid session found' } } } |