运行远程服务器上共享的可执行程序
站长推荐:NSetup一键部署软件
一键式完成美化安装包制作,自动增量升级,数据统计,数字签名。应对各种复杂场景,脚本模块化拆分,常规复杂的脚本代码,图形化设置。无需专业的研发经验,轻松完成项目部署。(www.nsetup.cn)
psexec是一个远程执行工具,你可以像使用telnet一样使用它。
它的使用格式为:
psexec \\远程机器ip [-u username [-p password]] [-c [-f]] [-i][-d] program [arguments]
它的参数有:
-u后面跟用户名 -p后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
-c <[路径]文件名>:拷贝文件到远程机器并运行(注意:运行结束后文件会自动删除)
-d 不等待程序执行完就返回,(比如要让远程机器运行tftp服务端的时候使用,不然psexec命令会一直等待tftp程序结束才会返回)
-i 在远程机器上运行一个名为psexesvc进程,(到底什么用弄不明白)
假设我在远程机器ip有一个账号,账号名是:abc 密码是:123
比如想要用telnet一样在远程系统上执行命令可以打:
psexec \\远程机器ip -u abc -p 123 cmd
如果想要远程机器执行本地c:\srm.exe文件可以打:
psexec \\远程机器ip -u abc -p 123 -c c:\srm.exe
如果想要让远程机器执行本地上tftp服务端,(假设tftp服务端在本地c:\tftp32.exe),可以打:
psexec \\远程机器ip -u abc -p 123 -c c:\tftp32.exe -d
//————————————————————————————————————-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
Usage: psexec [\\computer[,computer2[,...] | @file]][-u user [-p psswd][-n s][-l ][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,... ] cmd [arguments] -a Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: "-a 2,4" -c Copy the specified program to the remote system for execution. If you omit this option the application must be in the system path on the remote system. -d Don't wait for process to terminate (non-interactive). -e Does not load the specified account's profile. -f Copy the specified program even if the file already exists on the remote system. -i Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. -h If the target system is Vista or higher, has the process run with the account's elevated token, if available. -l Run process as limited user (strips the Administrators group and allows only privileges assigned to the Users group). On Windows Vista the process runs with Low Integrity. -n Specifies timeout in seconds connecting to remote computers. -p Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password. -s Run the remote process in the System account. -u Specifies optional user name for login to remote computer. -v Copy the specified file only if it has a higher version number or is newer on than the one on the remote system. -w Set the working directory of the process (relative to remote computer). -x Display the UI on the Winlogon secure desktop (local system only). -priority Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority. Use -background to run at low memory and I/O priority on Vista. computer Direct PsExec to run the application on the remote computer or computers specified. If you omit the computer name PsExec runs the application on the local system, and if you specify a wildcard (\\*), PsExec runs the command on all computers in the current domain. @file PsExec will execute the command on each of the computers listed in the file. program Name of application to execute. arguments Arguments to pass (note that file paths must be absolute paths on the target system). You can enclose applications that have spaces in their name with quotation marks e.g. psexec \\marklap "c:\long name app.exe". Input is only passed to the remote system when you press the enter key, and typing Ctrl-C terminates the remote process. |
学习日记,兼职软件设计,软件修改,毕业设计。
本文出自 学习日记,转载时请注明出处及相应链接。
本文永久链接: https://www.softwareace.cn/?p=359