Returns information about all the Terminal Services accounts on a computer.

This script was tested using Kixtart 2001 (412) for Microsoft Windows, available from Kixtart.org.

Kixtart
Edit|Remove
$strComputer = "."
$objWMIService = GetObject("winmgmts:\\"+ $strComputer + "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_TSAccount")
For Each $objItem in $colItems
    ? "Account Name:" + $objItem.AccountName
    ? "Audit Fail:" + $objItem.AuditFail
    ? "Audit Success:" + $objItem.AuditSuccess
    ? "Caption:" + $objItem.Caption
    ? "Description:" + $objItem.Description
    ? "Permissions Allowed:" + $objItem.PermissionsAllowed
    ? "Permissions Denied:" + $objItem.PermissionsDenied
    ? "Setting ID:" + $objItem.SettingID
    ? "SID:" + $objItem.SID
    ? "Terminal Name:" + $objItem.TerminalName
Next