FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

os:windows:wincheck:index.html



This is an old revision of the document!


Top#OS Management

Windows Check (wincheck.py)

$FHHOME/fabfile/wincheck.py


Operation

$ fab  -l |grep wincheck.
$ echo xx.xx.xx.xx | fab  auth.pro  wincheck.xxxx

Ref. Remote Shell Commands

$ 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


wincheck.py

$FHHOME/fabfile/wincheck.py

import sys
from fabric.api import *
from fabric.contrib import files

FHHOME=os.environ["FHHOME"]


#------------------------------------------------------------------
# wincheck.ipconfig_all
#------------------------------------------------------------------
@task
def chcp437():
    """chcp 437 # Change LANG To English"""
    run("chcp 437", shell=False, pty=False)


#================================================================================
# Network
#================================================================================
#------------------------------------------------------------------
# wincheck.ipconfig_all
#------------------------------------------------------------------
@task
def ipconfig_all():
    run("ipconfig /all", shell=False, pty=False)

#------------------------------------------------------------------
# wincheck.netstat_rn
#------------------------------------------------------------------
@task
def netstat_rn():
    run("netstat -rn", shell=False, pty=False)


#================================================================================
# User
#================================================================================
#------------------------------------------------------------------
# wincheck.net_user
#------------------------------------------------------------------
@task
def net_user():
    """ user list"""
    run("net user", shell=False, pty=False)

#------------------------------------------------------------------
# wincheck.net_user:
#------------------------------------------------------------------
@task
def net_user(user):
    run("net user %s" % user, shell=False, pty=False)

#------------------------------------------------------------------
# wincheck.net_user_active:
#------------------------------------------------------------------
@task
def net_user_active(user):
   """ make user active from disable"""
    run("net user %s /active" % user, shell=False, pty=False)


#------------------------------------------------------------------
# wincheck.net_localgroup_administrators
#------------------------------------------------------------------
@task
def net_localgroup_administrators():
    run("net localgroup administrators", shell=False, pty=False)

#------------------------------------------------------------------
# wincheck.net_localgroup_users
#------------------------------------------------------------------
@task
def net_localgroup_users():
    run("net localgroup users", shell=False, pty=False)



#================================================================================
# etc
#================================================================================
#------------------------------------------------------------------
# wincheck.systeminfo
#------------------------------------------------------------------
@task
def systeminfo():
    run("systeminfo", shell=False, pty=False)

#------------------------------------------------------------------
# wincheck.powershell_version
#------------------------------------------------------------------
@task
def powershell_version():
    run("PowerShell.exe -Command $PSVersionTable", shell=False, pty=False)







Top#OS Management



os/windows/wincheck/index.html.1517493502.txt.gz ยท Last modified: 2018/02/01 22:58 by kurihara