Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fmxdbc_listener.exe restart
#!/usr/bin/env python3
import sys
from winrm.protocol import Protocol
def xdbc_restart(host, user, password):
p = Protocol(
endpoint=('https://%s:5986/wsman' % host),
transport='ntlm',
username=user,
password=password,
server_cert_validation='ignore'
)
shell_id = p.open_shell()
command_id = p.run_command(shell_id, 'fmsadmin', ['restart', 'xdbc', '-y'])
std_out, std_err, status_code = p.get_command_output(shell_id, command_id)
p.cleanup_command(shell_id, command_id)
p.close_shell(shell_id)
return std_out.decode('utf-8'), std_err.decode('utf-8'), status_code
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='fmxdbc_listener.exe restarter')
parser.add_argument('-u', '--user', dest='user', help='[DOMAIN\]USERNAME')
parser.add_argument('-p', '--password', dest='password', help='password')
parser.add_argument('-h', '--host', dest='host', help='FMServer hostname or IP')
options = parser.parse_args()
sys.stdout.write('Restarting xDBC... ')
print(*xdbc_restart(options.host, options.user, options.password))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.