Public/Authentication/Get-SCASession.ps1
|
function Get-SCASession { <# .SYNOPSIS Lists psSCA sessions currently held in memory. .DESCRIPTION Returns one or more session objects created by New-SCASession. The access token on each object is a SecureString and is never displayed in plain text. .PARAMETER Name Return only the session with this name. Omit to return every active session. .EXAMPLE Get-SCASession Lists every active session. .EXAMPLE Get-SCASession -Name Production Returns the session named 'Production'. .INPUTS None. .OUTPUTS psSCA.Session .LINK https://api-docs.cyberark.com/create-api-token/docs/create-api-token #> [CmdletBinding()] [OutputType('psSCA.Session')] param( [Parameter(Position = 0)] [string]$Name ) if ($Name) { if ($script:SCASessions.Contains($Name)) { return $script:SCASessions[$Name] } return } foreach ($sessionName in $script:SCASessions.Keys) { $script:SCASessions[$sessionName] } } |