FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
os:windows:wincheck:index.html [2018/01/31 00:44] kurihara |
os:windows:wincheck:index.html [2018/05/13 23:19] (current) kurihara |
||
---|---|---|---|
Line 1: | Line 1: | ||
[[: | [[: | ||
- | ====== Windows Check (wincheck.py)===== | + | ====== Windows Check with Fabric |
$FHHOME/ | $FHHOME/ | ||
Line 7: | Line 7: | ||
\\ | \\ | ||
- | ===== Operation ===== | + | ===== Operation |
<sxh bash toolbar: | <sxh bash toolbar: | ||
Line 14: | Line 14: | ||
</ | </ | ||
- | ==== Ref. Remote Shell Commands | + | \\ |
+ | ==== How to Check to Use Fabric in Windows ==== | ||
+ | <sxh bash toolbar: | ||
+ | $ ssh user01@xx.xx.xx.xx hostname | ||
+ | $ ssh user01@xx.xx.xx.xx " | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | ==== Fabric one-line Task Examples ==== | ||
+ | ==Cmd.exe== | ||
+ | <sxh bash toolbar: | ||
+ | $ fab -H xx.xx.xx.xx -u USER -p PASSWORD --shell=" | ||
+ | $ echo xx.xx.xx.xx | fab auth.winpro --shell=" | ||
+ | </ | ||
+ | |||
+ | ==PowerShell.exe== | ||
+ | <sxh bash toolbar: | ||
+ | $ fab -H xx.xx.xx.xx -u USER -p PASSWORD --shell="" | ||
+ | $ fab -H xx.xx.xx.xx -u USER -p PASSWORD --shell=" | ||
+ | </ | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ echo xx.xx.xx.xx | + | ## This isn't work well. Why? Please tell me. |
- | $ echo xx.xx.xx.xx | + | $ fab -H xx.xx.xx.xx -u USER -p PASSWORD --shell="" |
+ | $ fab -H xx.xx.xx.xx | ||
</ | </ | ||
Line 26: | Line 47: | ||
<sxh python toolbar: | <sxh python toolbar: | ||
- | import sys | + | import sys, os |
from fabric.api import * | from fabric.api import * | ||
from fabric.contrib import files | from fabric.contrib import files | ||
- | from fabric.operations import open_shell | ||
FHHOME=os.environ[" | FHHOME=os.environ[" | ||
+ | |||
+ | |||
+ | # | ||
+ | # wincheck.ipconfig_all | ||
+ | # | ||
+ | @task | ||
+ | def chcp437(): | ||
+ | """ | ||
+ | run(" | ||
+ | |||
# | # | ||
Line 41: | Line 71: | ||
@task | @task | ||
def ipconfig_all(): | def ipconfig_all(): | ||
- | | + | run(" |
- | | + | |
# | # | ||
Line 49: | Line 78: | ||
@task | @task | ||
def netstat_rn(): | def netstat_rn(): | ||
- | | + | |
- | run("netstat | + | |
+ | # | ||
+ | # wincheck.test_netconnection: | ||
+ | # | ||
+ | @task | ||
+ | def test_netconnection(host, | ||
+ | | ||
+ | run(' | ||
+ | run("PowerShell.exe | ||
Line 61: | Line 99: | ||
@task | @task | ||
def net_user(): | def net_user(): | ||
- | | + | |
- | run(" | + | run(" |
+ | |||
+ | # | ||
+ | # wincheck.net_user: | ||
+ | # | ||
+ | @task | ||
+ | def net_user(user): | ||
+ | run("net user %s" % user, shell=False, | ||
+ | |||
+ | # | ||
+ | # wincheck.net_user_active: | ||
+ | # | ||
+ | @task | ||
+ | def net_user_active(user): | ||
+ | """ | ||
+ | run(" | ||
# | # | ||
Line 69: | Line 123: | ||
@task | @task | ||
def net_localgroup_administrators(): | def net_localgroup_administrators(): | ||
- | | + | run(" |
- | | + | |
# | # | ||
Line 77: | Line 130: | ||
@task | @task | ||
def net_localgroup_users(): | def net_localgroup_users(): | ||
- | | + | run(" |
- | | + | |
Line 90: | Line 142: | ||
@task | @task | ||
def systeminfo(): | def systeminfo(): | ||
- | | + | run(" |
- | | + | |
# | # | ||
Line 98: | Line 149: | ||
@task | @task | ||
def powershell_version(): | def powershell_version(): | ||
- | | + | |
- | run($PSVersionTable) | + | |
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.