List Network Adapters for Remote Desktop Connection (RDP-tcp Adapters)

Please use the script to get a list of network adapters which are configured for Remote Desktop Connection and get information of their Settings.

def ExecuteCMD(CMD, OUT = False):
    import ctypes
    from subprocess import PIPE, Popen
    class disable_file_system_redirection:
        _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
        _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
        def __enter__(self):
            self.old_value = ctypes.c_long()
            self.success = self._disable(ctypes.byref(self.old_value))
        def __exit__(self, type, value, traceback):
            if self.success:

    with disable_file_system_redirection():
        OBJ = Popen(CMD, shell = True, stdout = PIPE, stderr = PIPE)
    out, err = OBJ.communicate()
    RET = OBJ.returncode
    if not RET:
        if OUT:
            if out:
                return out.strip()
                return True
            return True
    return False

def writeFile(con, ext):
    import os
    import random
    FILEPATH = os.path.join(os.environ['TEMP'], str(random.randint(1, 10000))+ext)
    with open(FILEPATH, 'w') as f:
    return FILEPATH

## VBScript for Enumerating IRQ Settings
VBScript=r'''On Error Resume Next
strComputer = "."
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = GetObject("winmgmts:{authenticationLevel=pktPrivacy}!Root/CIMv2/TerminalServices")
Set colSWbemObjectSet = objSWbemServices.InstancesOf("Win32_TSRemoteControlSetting")
For Each objSWbemObject In colSWbemObjectSet
    WScript.Echo "Caption: " & objSWbemObject.Caption
    Wscript.Echo "Description: " & objSWbemObject.Description
    Wscript.Echo "InstallDate: " & objSWbemObject.InstallDate
    Wscript.Echo "Name: " & objSWbemObject.Name
    Wscript.Echo "Status: " & objSWbemObject.Status
    Wscript.Echo "TerminalName: " & objSWbemObject.TerminalName
    Wscript.Echo "LevelOfControl: " & objSWbemObject.LevelOfControl
    Wscript.Echo "PolicySourceLevelOfControl: " & objSWbemObject.PolicySourceLevelOfControl
    Wscript.Echo "RemoteControlPolicy: " & objSWbemObject.RemoteControlPolicy

file=writeFile(VBScript, '.vbs')
import os
if os.path.isfile(file):
    print ExecuteCMD('cscript "'+file+'"', True)

## cleans up the vbs script file

Script File:

Sample Output:

RDP-tcp Adapters.png

20170223-List-Network-Adapters-Configured-for-Remote-Desktop-Connection.json (3.39 KB)