Daly Source: Http://www.cnblogs.com/daly Welcome reprint, Please also keep this statement. Thank you!
One of the previous projects needed to be able to perform some Windows system operations remotely from the command line.
So decided to use: Python + vnctool
Environment Preparation:
1.2 Windows machines. One of them serves as the lead machine, one for the target machine.
2. Python2.7.5, VNC-5.0.5 install package and some other dependent packages. Refer to the following steps for details.
On the leads 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:P Ath; 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 leads 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 leads machine and the target machine)
1. After install VNC Server successfully, right click VNC icon in the bottom right corner of the toolbar > select "Opti ONS ... "
2. Then select the ' Advanced ... ' button:
3. Choose Authentication as "VNC password" and click "Configure:" > Input the password to Configure > Choose encryp tion 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 leads 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'll 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