Functions/Authentication/Get-PASSession.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# .ExternalHelp psPAS-help.xml
function Get-PASSession {
    [CmdletBinding()]
    param( )

    BEGIN { }#begin

    PROCESS {

        Try {

            $UserName = Get-PASLoggedOnUser -ErrorAction Stop | Select-Object -ExpandProperty Username

        } Catch { $UserName = $null }

        [PSCustomObject]@{
            User            = $UserName
            BaseURI         = $Script:BaseURI
            ExternalVersion = $Script:ExternalVersion
            WebSession      = $Script:WebSession
        } | Add-ObjectDetail -typename psPAS.CyberArk.Vault.Session

    }#process

    END { }#end

}