作者:Daly 出处:http://www.cnblogs.com/daly 欢迎转载,也请保留这段声明。谢谢!

之前的一个项目需要需求希望可以通过命令行去远程执行一些Windows 系统操作。

所以决定采用: Python + vnctool

环境准备:

1. 2 台Windows机器。 其中一台作为lead机器, 一台作target机器。

2. Python2.7.5, VNC-5.0.5安装包和其他一些依赖包。 具体可以参考以下步骤。

On the lead machine:

1. Install Python2.7

1.1. Start with a Windows

1.2. Install python via python-2.7.5.msi

1.3. Set the Environment Variables (2 methods):

a. Open up PowerShell, and paste in the following:

[Environment]::SetEnvironmentVariable("Path",

"$env:Path;C:\Python27\;C:\Python27\Scripts\", "User")

b. Right click Computer and select "Properties" > click "Advanced system settings" > click "Environment Variables..." > select "Path" in "System variables" field and click "Edit" > add "C:\Python27\;C:\Python27\Scripts\;" at the "Variable value"

2. Install Twisted

2.1. Install Twisted via Twisted-13.1.0.win32-py2.7.exe

3. Install PIL

3.1. Install PIL via PIL-1.1.7.win32-py2.7.exe

4. Copy 2 scripts to C:\Python27\Scripts

4.1. Copy file ez_setup.py and get-pip.py to C:\Python27\Scripts

5. Install setuptools

5.1. Download setuptools-1.1.6

5.2. Launch CMD and input the follow commands to install setuptools:

> cd c:\setuptools-1.1.6

> python setup.py install

6. Install pip

6.1. Download pip-1.4.1

6.2. Launch CMD and input the follow commands to install pip:

> cd c:\pip-1.4.1

> python setup.py install

7. Install distribute

7.1. Download distribute-0.7.3

7.2. Launch CMD and input the follow commands to install distribute:

> cd c:\distribute-0.7.3

> python setup.py install

8. Install zope.interface

8.1. Download zope.interface-4.05

8.2. Launch CMD and input the follow commands to install zope.interface:

> cd c:\zope.interface-4.05

> python setup.py install

9. Install vncdotool

9.1. Download vncdotool -0.8.0

9.2. Launch CMD and input the follow commands to install vncdotool:

> cd c:\vncdotool -0.8.0

> python setup.py install

VNC Server installation(Install it on the lead machine and the target machine)

1. Install VNC Server

1.1. Download VNC-5.0.5-Windows.exe

1.2. Install VNC via VNC-5.0.5-Windows.exe

VNC Configuration (Configure it on the lead machine and the target machine)

1. After install VNC Server successfully, right click VNC icon in the bottom right corner of the toolbar > select "Options..."

2. Then select the "Advanced..." button:

3. Choose Authentication as "VNC password" and click "Configure.." > input the password to configure > choose Encryption as "Prefer off"

4. Select tab "Expert" > set the "ProtocolVersion" for the VNCServer to 4.0.

5. Click "Apply" and click "OK" to finish the configuration

VNCDO usage

1. Test the vncdo take effect:

On the lead machine, at the CMD prompt input:

> vncdo.exe -s xxx.xxx.xxx.xxx[the target machine's ip]  -p password[the password you set at VNC Configuration #3]  capture screenshot.png

you will get the target machine's currently screenshot

2. vncdo usage

a. Input "vncdo --help" in CMD to get the vncdo all usage

b. Some useful usage:

>vncdo -s xxx.xxx.xxx.xxx -p password type "hello"

>vncdo -s xxx.xxx.xxx.xxx -p password key ctrl-alt-del expect a.png 0

>vncdo -s xxx.xxx.xxx.xxx -p password type "administrator" key tab type "password" key enter expect d.png 0

3. Get more info from the website: http://pythonhosted.org/vncdotool/

https://pypi.python.org/pypi/vncdotool

vncdotool - A command line VNC client的更多相关文章

  1. Proxy settings in TortoiseSVN and command line svn client

    The server file is created when you install TortoiseSVN, Eclipse or command-line Subversion. Use the ...

  2. Can't use Subversion command line client: svn Probably the path to Subversion executable is wrong. Fix it.

    1.最近使用SVN工具时,Checkout出项目到本地后后,然后将其导入到Intellij idea中开发,在提交svn代码的时候,出现这样的错误:Can't use Subversion comma ...

  3. 使用intellij的svn时提示出错: Can't use Subversion command line client: svn.Errors found while svn working copies detection.

    使用Intellij的svn时提示出错:Can't use Subversion command line client: svn. Errors found while svn working co ...

  4. Can't use Subversion command line client:svn

    在Intellij IDEA里checkout东西时出先这个错误提示:Can't use Subversion command line client:svn Subversion command l ...

  5. MySQL 5.7 Command Line Client输入密码后闪退和windows下mysql忘记root密码的解决办法

    MySQL 5.7 Command Line Client输入密码后闪退的问题: 问题分析: 1.查看mysql command line client默认执行的一些参数.方法:开始->所有程序 ...

  6. Android Studio集成SVN报错:can't use subversion command line client : svn

    Android Studio集成SVN插件,check out出代码后,每次开启都会在右上角出现如下错误: Can't use Subversion command line client: svn ...

  7. MySQL中MySQL X.X Command Line Client一闪而过的问题

    问题介绍:我安装完MySQL(我安装的是5.5)后,使用MySQL 5.5 Command Line Client,每次点击,总是一闪而过.解决方法如下:      首先进入cmd 切入MySQL的安 ...

  8. Webstorm 提示 Can't use Subversion command line client

    Webstorm 提示 Can't use Subversion command line client Webstorm 提示 Can't use Subversion command line c ...

  9. Mysql安装后打开MySQL Command Line Client闪退解决方法

    1.开始菜单下;Mysql--->mysql server 5.6-->mysql command line Client ---右击,选择属性 2.在属性下查看目标位置: 3.将安装目录 ...

随机推荐

  1. 深入理解MyBatis框架的的配置信息

    面对一个框架,最重要的不是说回用其代码就可以了,我们需要了解其思想,这样才能更快更好的掌握这个框架.而对于一个框架,最重要的就是其配置文件的作用及功能了.下面,我就来谈一谈我今天遇到的这个MyBati ...

  2. [java面试]宇信易诚 广州分公司 java笔试题目回忆录

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/28479895 作者:sushengmiyan -------------------- ...

  3. OpenCV计算物体的重心坐标(2值图像)

    效果图: 代码: // FindGravity.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream& ...

  4. 《java入门第一季》之集合框架(Collection小儿子Set集合)

    /*  * Collection主要的连个儿子:  * |--List  * 有序(存储顺序和取出顺序一致),可重复  * |--Set  * 无序(存储顺序和取出顺序不一致),唯一  *   * H ...

  5. OJ题:字符串分隔

    题目描述 •连续输入字符串,请按长度为8拆分每个字符串后输出到新的字符串数组:•长度不是8整数倍的字符串请在后面补数字0,空字符串不处理. 输入描述: 连续输入字符串(输入2次,每个字符串长度小于10 ...

  6. 【一天一道LeetCode】#72. Edit Distance

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given t ...

  7. [信号处理技术]关于EMD的产生

    通俗易懂,有助于理解EMD和HHT,就原封不动的搬过来了. 原文链接:关于EMD的产生 自傅里叶变换与频谱分析技术产生,人们得以从另外一个角度观察时域信号,信号里各个点的密集程度,得以确定性地度量.之 ...

  8. python的exec

    exec "一条python语句" 这样会执行python 语句.用于执行储存在字符串或文件中的Python语句. 当然 也可以 用 exec(str)这种方式, 总之一句话,尽量 ...

  9. Leetcode_136_Single Number

    本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/42713315 Given an array of inte ...

  10. Vim/Vi实用技巧(第二版)

    Vim/Vi实用技巧 1.导入文件 :r [文件名] #导入到当前编辑的文件中 如 :r /etc/inittab 文件上部为/etc/services文件,下部为/etc/inittab文件 2.执 ...