Skip to content

Instantly share code, notes, and snippets.

@devilrancy
Created February 15, 2017 06:14
Show Gist options
  • Save devilrancy/dd56077afd81ab312726264e16f39c77 to your computer and use it in GitHub Desktop.
Save devilrancy/dd56077afd81ab312726264e16f39c77 to your computer and use it in GitHub Desktop.
using python pywinrm to connect with windows
#!/usr/bin/env python
import winrm
ps_script = open('scripts/mem.ps1','r').read()
s = winrm.Session('10.2.0.42', auth=('the_username', 'the_password'))
r = s.run_ps(ps_script)
print r.status_code
print r.std_out
print r.std_err
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment