# Get-TSdomain.ps1# Gets the domain name of the domain in which the TS is in# thomas lee - tfl@psp.co.uk
# first, get the TS Setting object.$ts=get-WMIObject Win32_TerminalServiceSetting -Namespace ROOT\CIMV2\TerminalServices
# now get the domain$domain = $ts.GetDomain()
# and display results
"The TS Server {0} is in domain: {1}" -f $ts.servername, $domain.domain