Link to home
Start Free TrialLog in
Avatar of TSC70
TSC70Flag for United Kingdom of Great Britain and Northern Ireland

asked on

query termserver not showing all servers

Anyone have any idea why query termserver might not show all RDS servers on a domain? It shows all the 2008R2 servers correctly and shows one of the 2012R2 servers but doesn't show an additional 3 2012R2 servers setup exactly the same as the one that is shown (same AD groups etc.)

All servers are functioning perfectly fine so I can't figure out why it might be excluding some server from detection. I've checked this like firewall, remote registry, AD group membership but can't find a cause. Is anyone aware what query termserver actually looks at to get results?

Thanks,

TSC70
Avatar of Tahir Qureshi
Tahir Qureshi
Flag of Australia image

how are you trying to find Termserver. Can you share the script
Avatar of TSC70

ASKER

Sorry should have stated, I'm just using the cmdline, so literally just "query termserver" in the same way you would use "query user" or "query session"
May I ask is it Physical server or VM

Please review this article
http://support.microsoft.com/kb/281307

That article also states that:
By default, only Windows Server 2003-based Terminal Services servers and Windows 2000-based servers with Terminal Services installed in either Application Server mode or in Remote Administration mode advertise themselves as Terminal Services servers. This behavior makes the browse list in Remote Desktop and Terminal Services Client more usable, and makes sure that only Terminal Services servers appear in Windows 2000 and Windows Server 2003 Terminal Services Manager.

Is terminal services installed on these servers in either Application Server or Remote Administration mode? Is the computer browser service running on the effected servers?

Try Restart the computer Browser and restarted the server.
Avatar of TSC70

ASKER

Mix of VM's and physical. The servers that aren't advertising themselves are 2012R2 servers though but there is a similar 2012R2 server setup which is advertising itself. The server in question have been restarted multiple times and the computer browser service is disabled across the board so it can't be that.

I tried that link but there doesn't seem to be anything behind it?
Dear Use this below powershell script

# Import the Active Directory module for the Get-ADComputer CmdLet
Import-Module ActiveDirectory
# Get today’s date for the report
$today = Get-Date
# Setup email parameters
$subject = “ACTIVE SERVER SESSIONS REPORT – ” + $today
$priority = “Normal”
$smtpServer = “YourMailServer”
$emailFrom = “email@yourdomain.com”
$emailTo = “email@yourdomain.com”
# Create a fresh variable to collect the results. You can use this to output as desired
$SessionList = “ACTIVE SERVER SESSIONS REPORT – ” + $today + “`n`n”
# Query Active Directory for computers running a Server operating system
$Servers = Get-ADComputer -Filter {OperatingSystem -like “*server*”}
# Loop through the list to query each server for login sessions
ForEach ($Server in $Servers) {
$ServerName = $Server.Name
# When running interactively, uncomment the Write-Host line below to show which server is being queried
# Write-Host “Querying $ServerName”
# Run the qwinsta.exe and parse the output
$queryResults = (qwinsta /server:$ServerName | foreach { (($_.trim() -replace “s+”,”,”))} | ConvertFrom-Csv)
# Pull the session information from each instance
ForEach ($queryResult in $queryResults) {
$RDPUser = $queryResult.USERNAME
$sessionType = $queryResult.SESSIONNAME
# We only want to display where a “person” is logged in. Otherwise unused sessions show up as USERNAME as a number
If (($RDPUser -match “[a-z]”) -and ($RDPUser -ne $NULL)) {
# When running interactively, uncomment the Write-Host line below to show the output to screen
# Write-Host $ServerName logged in by $RDPUser on $sessionType
$SessionList = $SessionList + “`n`n” + $ServerName + ” logged in by ” + $RDPUser + ” on ” + $sessionType   }
}
}
# Send the report email
Send-MailMessage -To $emailTo -Subject $subject -Body $SessionList -SmtpServer $smtpServer -From $emailFrom -Priority $priority
# When running interactively, uncomment the Write-Host line below to see the full list on screen
# $SessionList

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of TSC70
TSC70
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial