I'd like to write a PS script to find any user who has a disconnected RDP session on a server, if it's been disconnected for longer than one day. Ultimately either email myself the results. I'm trying to use the quser
command as that seems to have the info I want, but I can't seem to do anything with those results. Here is what I have so far.
$Servers = Get-ADComputer -Filter * -SearchBase "OU=Servers,DC=domain,DC=com"
foreach ($Server in $Servers) {
$Results = (quser /server:$ServerName)
Write-Host $Results
}