is there a command powershell command that tells whether RDP is enabled, and or being used etc?

Viewed 29

like a status/info command? something like ipconfig but RDP related. The closest I got to is this

Get-Service -Name "Remote Desktop Services", "Remote Desktop Configuration", "Remote Desktop Services UserMode Port Redirector"

but doesnt this just say whether there is an active RDP session running?

1 Answers

To determine if RDP connections to the local machine are enabled in principle (based on this helpful techdirectarchive.com blog post):

$rdpEnabled = 
  0 -eq (Get-ItemPropertyValue 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' fDenyTSConnections)

To determine if there are currently active RDP connections to the local machine (building on js2010's helpful comment):

$rdpSessionsPresent = 
  quser.exe | Select-String -Quiet '\brdp-'
Related