functions/distributed-engines/Get-TssDistributedEngineSite.ps1
function Get-TssDistributedEngineSite { <# .SYNOPSIS Get a Site configuration .DESCRIPTION Get a Site configuration .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssDistributedEngineSite -TssSession $session -Id 4 Returns configuration details for Site ID 4 .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/distributed-engines/Get-TssDistributedEngineSite .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/distributed-engines/Get-TssDistributedEngineSite.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.DistributedEngines.Site')] param ( # TssSession object created by New-TssSession for authentication [Parameter(Mandatory,ValueFromPipeline,Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, # Site ID [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [Alias("SiteId")] [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.000064' $PSCmdlet.MyInvocation foreach ($site in $Id) { $uri = $TssSession.ApiUrl, 'distributed-engine', 'site', $site -join '/' $invokeParams.Uri = $uri $invokeParams.Method = 'GET' Write-Verbose "Performing the operation $($invokeParams.Method) $($invokeParams.Uri)" try { $apiResponse = Invoke-TssApi @invokeParams $restResponse = . $ProcessResponse $apiResponse } catch { Write-Warning "Issue getting Site [$site]" $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.DistributedEngines.Site]$restResponse } } } else { Write-Warning "No valid session found" } } } |