Lists the network adapters that can be configured for Terminal Services.

This script was tested using Perl for Microsoft Windows, available from ActiveState.

use Win32::OLE('in');
use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;

$computer = ".";
$objWMIService = Win32::OLE->GetObject
    ("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
$colItems = $objWMIService->ExecQuery
    ("SELECT * FROM Win32_TSNetworkAdapterListSetting","WQL",wbemFlagReturnImmediately | wbemFlagForwardOnly);

foreach my $objItem (in $colItems)
      print "Caption: $objItem->{Caption}\n";
      print "Description: $objItem->{Description}\n";
      print "Network Adapter ID: $objItem->{NetworkAdapterID}\n";
      print "Setting ID: $objItem->{SettingID}\n";
      print "Terminal Name: $objItem->{TerminalName}\n";
      print "Terminal Protocol: $objItem->{TerminalProtocol}\n";
      print "Transport: $objItem->{Transport}\n";
      print "\n";