plink 是一個可以用來遠端連線管理主機的程式。
plink 使用參數
# /usr/bin/plink
PuTTY Link: command-line connection utility
Unidentified build, Mar 14 2015 13:36:11
Usage: plink [options] [user@]host [command]
(“host” can also be a PuTTY saved session name)
Options:
-V print version information and exit
-pgpfp print PGP key fingerprints and exit
-v show verbose messages
-load sessname Load settings from saved session
-ssh -telnet -rlogin -raw -serial
force use of a particular protocol
-P port connect to specified port
-l user connect with specified username
-batch disable all interactive prompts
The following options only apply to SSH connections:
-pw passw login with specified password
-D [listen-IP:]listen-port
Dynamic SOCKS-based port forwarding
-L [listen-IP:]listen-port:host:port
Forward local port to remote address
-R [listen-IP:]listen-port:host:port
Forward remote port to local address
-X -x enable / disable X11 forwarding
-A -a enable / disable agent forwarding
-t -T enable / disable pty allocation
-1 -2 force use of particular protocol version
-4 -6 force use of IPv4 or IPv6
-C enable compression
-i key private key file for authentication
-noagent disable use of Pageant
-agent enable use of Pageant
-m file read remote command(s) from file
-s remote command is an SSH subsystem (SSH-2 only)
-N don’t start a shell/command (SSH-2 only)
-nc host:port
open tunnel in place of session (SSH-2 only)
-sercfg configuration-string (e.g. 19200,8,n,1,X)
Specify the serial configuration (serial only)
[@more@]比較常用的參數
-l 要登入的使用者
-pw 登入的密碼
底下列出幾個實例
1. 關閉遠端 Windows 主機
# echo y | /usr/bin/plink -l Administrator -pw 123456 192.168.1.112 “shutdown -s -t 0”
2. 遠端 Windows 主機重新啟動
# echo y | /usr/bin/plink -l Administrator -pw 123456 192.168.1.112 “shutdown -r -t 0”
3. 自動安裝桌面上的 PotPlayer
/S 是 PotPlayer 的自動安裝參數
# echo y | /usr/bin/plink -pw 123456 Administrator@192.168.1.112 “/cygdrive/c/Users/Administrator/Desktop/PotPlayerSetup64.exe /S”
以上是針對一台電腦,如果是整個電腦教室,則可以利用 Script 檔的方式來達成!