Cyber Safety
On this quick article I’ll present how one can record all logged on native customers with the quser.exe device. Quser shows details about logged on customers on the native laptop and on a Distant Desktop Session Host server.
PowerShell Code
Enter the code under to find out all logged on customers. A number of customers, if any, can be separated by comma.
$customers = quser.exe | Choose-Object -Skip 1
$unames = @()
foreach ($u in $customers) {
$uname = ($u.trim() -replace 's+',' ' -replace '>','' -split 's')[0]
$unames += New-Object psobject -Property ([ordered]@{
'Logged in Customers' = [string]$uname
})
}
Write-Output $unames
The code results in the next output.
Revealed by