File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 76
76
$_.TimeCreated -gt $LogonTime -and
77
77
$_.ID -in $SessionStopIds -and
78
78
(([xml ]$_.ToXml ()).Event.EventData.Data | where { $_.Name -eq ' TargetLogonId' }).' #text' -eq $LogonId
79
- }) | select - First 1
79
+ }) | select - last 1
80
80
if (-not $SessionEndEvent ) # # This be improved by seeing if this is the latest logon event
81
81
{
82
82
Write-Verbose - Message " Could not find a session end event for logon ID [$ ( $LogonId ) ]. Assuming most current"
98
98
' Session Active (Days)' = [math ]::Round((New-TimeSpan - Start $LogonTime - End $LogoffTime ).TotalDays, 2 )
99
99
' Session Active (Min)' = [math ]::Round((New-TimeSpan - Start $LogonTime - End $LogoffTime ).TotalMinutes, 2 )
100
100
}
101
- [pscustomobject ]$output
101
+ [pscustomobject ]$output | ft - AutoSize - HideTableHeaders
102
102
}
103
103
}
104
104
})
111
111
catch
112
112
{
113
113
$PSCmdlet.ThrowTerminatingError ($_ )
114
- }
114
+ }
You can’t perform that action at this time.
0 commit comments