update activitystats.ps1 to have better statuses
This commit is contained in:
parent
5f3f90b8e3
commit
e01ad4fcba
12
activitystats.ps1
Normal file → Executable file
12
activitystats.ps1
Normal file → Executable file
@ -47,9 +47,9 @@ $windowsEdition = (Get-CimInstance Win32_OperatingSystem).Caption
|
||||
$idleTime = [UserInput]::GetIdleTime()
|
||||
if ($idleTime.TotalMinutes -gt 15) {
|
||||
$lastActive = (Get-Date).add(-$idleTime)
|
||||
Write-Host "($username) is logged in via Console and inactive since $lastActive."
|
||||
Write-Host "($username) [console] logged in and inactive since $lastActive."
|
||||
} else {
|
||||
Write-Host "($username) is currently logged in via Console and active."
|
||||
Write-Host "($username) [console] is logged in and active."
|
||||
}
|
||||
} elseif ($rdpSession) {
|
||||
$username = ($rdpSession -split "\s+")[2]
|
||||
@ -57,9 +57,9 @@ $windowsEdition = (Get-CimInstance Win32_OperatingSystem).Caption
|
||||
$idleTime = [UserInput]::GetIdleTime()
|
||||
if ($idleTime.TotalMinutes -gt 15) {
|
||||
$lastActive = (Get-Date).add(-$idleTime)
|
||||
Write-Host "($username) is logged in via RDP and inactive since $lastActive."
|
||||
Write-Host "($username) [mstsc] logged in and inactive since $lastActive."
|
||||
} else {
|
||||
Write-Host "($username) is currently logged in via RDP and active."
|
||||
Write-Host "($username) [mstsc] currently logged in and active."
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,9 +77,9 @@ $windowsEdition = (Get-CimInstance Win32_OperatingSystem).Caption
|
||||
$idleTime = [UserInput]::GetIdleTime()
|
||||
if ($idleTime.TotalMinutes -gt 15) {
|
||||
$lastActive = (Get-Date).add(-$idleTime)
|
||||
Write-Host "($username) is logged in and inactive since $lastActive"
|
||||
Write-Host "($username) [console] logged in and inactive since $lastActive"
|
||||
} else {
|
||||
Write-Host "($username) is currently logged on and active."
|
||||
Write-Host "($username) [console] currently logged on and active."
|
||||
}
|
||||
} else {
|
||||
Write-Host "No user is currently logged on."
|
||||
|
Loading…
Reference in New Issue
Block a user