First, you would need to enable auditing of these events on your Windows machines and then use Lansweeper to pull the event logs.
Here’s a PowerShell script that you can use to pull the relevant event logs:
# Define the event IDs for logoff and lock events
$logoffEventID = 4647
$lockEventID = 4800
# Get the event logs
$logoffEvents = Get-WinEvent -FilterHashtable @{Logname='Security'; ID=$logoffEventID}
$lockEvents = Get-WinEvent -FilterHashtable @{Logname='Security'; ID=$lockEventID}
# Create a custom object for each event and output it
$logoffEvents | ForEach-Object {
[PSCustomObject]@{
Time = $_.TimeCreated
User = $_.Properties[1].Value
Event = "Logoff"
}
}
$lockEvents | ForEach-Object {
[PSCustomObject]@{
Time = $_.TimeCreated
User = $_.Properties[1].Value
Event = "Lock"
}
}
This script will output a list of logoff and lock events with the time they occurred and the user who triggered them. From there, I assume it would be possible to have Lansweeper look at the eventlog for your assets, find those eventIDs, then pipe them into a report for you.
That being said, you'd have to rescan the devices to get the most uptodate eventlog whenever you wanted the data.
Ill keep digging.