$FHHOME/fabfile/winope.py
$ fab -l |grep winope $ echo xx.xx.xx.xx | fab auth.pro winope.xxxx $ echo xx.xx.xx.xx | fab auth.pro winope.cmd:hostname
$ ssh user01@xx.xx.xx.xx hostname $ ssh user01@xx.xx.xx.xx "PowerShell.exe -Command Get-Host"
$ fab -H xx.xx.xx.xx -u USER -p PASSWORD --shell="Cmd.exe /C" --no-pty -- hostname $ echo xx.xx.xx.xx | fab auth.winpro --shell="Cmd.exe /C" --no-pty -- ipconfig /all
$FHHOME/fabfile/winope.py
import sys, os
from fabric.api import *
from fabric.contrib import files
FHHOME=os.environ["FHHOME"]
#------------------------------------------------------------------
# winope.cmd
#------------------------------------------------------------------
@task
def cmd(cmd):
"""winope.cmd:hostname"""
run("%s" % cmd, shell=False, pty=False)
#------------------------------------------------------------------
# winope.powershell:'$PSVersionTable'
#------------------------------------------------------------------
@task
def powershell(cmd):
"""winope.powershell:'$PSVersionTable' """
run("PowerShell.exe -Command %s" % cmd, shell=False, pty=False)
#------------------------------------------------------------------
# winope.put:local, remote
#------------------------------------------------------------------
@task
def put(local, remote):
""" winope.put:local,remote # /tmp/test.txt C:\\tmp\\ """
put("%s" % local, "%s" % remote)
#------------------------------------------------------------------
# winope.get:remote, local
#------------------------------------------------------------------
@task
def get(remote, local):
""" winope.get:remote, local # C:\\tmp\\test.txt , /tmp/ """
get("%s" % remote, "%s" % local)