This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # USAGE: python rdp-disconnect.py -u kadir.malak -s 192.168.0.10 192.168.0.11 somehostname1 somehostname2 | |
| from subprocess import check_output, STDOUT | |
| import argparse | |
| def rdp_session_id(server, username): | |
| output = check_output('qwinsta /server:%s %s' % (server, username), stderr=STDOUT).decode('latin1') | |
| if 'No session exists' in output: | |
| return -1 | |
| lines = [line.split() for line in output.split('\r\n')] |
NewerOlder