public/Session/Get-Session.ps1
using namespace System.Management.Automation using module '..\..\modules\Enums.psm1' using module '..\..\modules\Helper\DateTimeHelper.psm1' using module '..\..\modules\Session.psd1' function Get-Session{ [CmdletBinding()] [Alias('gs')] param( [int] $id, [switch] $reimport ) if ([Session]::activeSessions.Count -eq 0){ Write-Host $LocalizedData.NoActiveSessionMessage } if ($id){ $session = [Session]::getSession($id) if ($session){ [Session]::currentSessionId = $id } } else { $session = [Session]::getCurrent() } Write-Output ([Session]::AllSessionInfo()) if ($reimport){ $params = @{} $params.Add('AsJob', $true) #$session.IsAsync() $params.Add('operator', $session.Operator) $params.Add('environment', $session.Environment) $params.Add('source', $session.config.sources) $params.Add('operator', $session.Operator) switch ($session.queryType) { ([QUERY_TYPE]::matchId) { $params.Add('matchId', $session.matchId) } ([QUERY_TYPE]::datetimeInterval) { $params.Add('matchId', $session.matchId) $params.Add('referentTime', $session.config.referentTime) $params.Add('timeSpan', $session.config.timeSpan) } ([QUERY_TYPE]::combined) { $params.Add('matchId', $session.matchId) $params.Add('referentTime', $session.config.referentTime) $params.Add('timeSpan', $session.config.timeSpan) } } Import-AuditLogs @params } } |