PowerShell: Find Remote Desktop Servers on A Domain

Remote Desktop Servers have a way of multiplying themselves like some kind of organic creature. Most administrators know how to deploy RDS and it is a good to solution for a variety of issues. The simple script below scans domain servers for the installed features.

$ErrorActionPreference = "SilentlyContinue"
$Servers = Get-ADComputer -Filter 'Operatingsystem -Like "*server*"' -Properties DnsHostName |
Select-Object dnshostname -ExpandProperty DnsHostN be ame
Foreach ($Server in $Servers){
Get-WMIObject -Class Win32_ServerFeature -ComputerName $Server -Property * |
Where-Object {$_.Name -like "Remote Desktop Services"} |
Select-Object PSComputerName
}

Leave a comment