关于psexec工具的基本使用——简单、强大

    当你工作中需要执行远程命令时,就用到了psexec。psexec使用简单,但是功能却是很强大。下面就来介绍psexec的基本使用方法。

首先下载psexec

[ psexec官方下载地址 ]

    psexec下载完成后,将psexec压缩包解压到你指定的一个路径,比如我将psexec的压缩包解压到d:\psexec 。然后,我们就可以开始使用psexec了。打开cmd命令提示符,进入你解压后的文件夹,输入psexec回车,就能看到如下psexec的语法提示:

psexec 语法提示:
PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec executes a program on a remote system, where remotely executed console
applications execute interactively.

Usage: psexec [\computer[,computer2[,…] | @file]][-u user [-p psswd][-n s][-r servicename][-h][-l][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-][-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.
-r Specifies the name of the remote service to create or interact.
with.
-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.
cmd Name of application to execute.
arguments Arguments to pass (note that file paths must be
absolute paths on the target system).
-accepteula This flag supresses the display of the license dialog.

You can enclose applications that have spaces in their name withquotation marks e.g. psexec \marklap “c:\long name app.exe”.
Input is only passed to the remote system when you press the enterkey, and typing Ctrl-C terminates the remote process.

If you omit a user name the process will run in the context of youraccount on the remote system, but will not have access to networkresources (because it is impersonating). Specify a valid user namein the Domain\User syntax if the remote process requires accessto network resources or to run in a different account. Note thatthe password and command is encrypted in transit to the remote system.
Error codes returned by PsExec are specific to the applications you execute.

  在psexec [\\computer[,computer2[,...] | @file]][-u user [-p psswd][-n s][-r servicename][-h][-l][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,...] cmd [arguments]指令中,中括号内的是可选参数,括号外的是必须的参数。各参数对应的意思,可以在上述英文中看到。出现上述提示说明你的psexec可以正常使用。然后,开始调用远程EXE文件,比如我的远程IP为:192.168.0.117,用户名使用管理员权限:Administrator,密码为:Win2008 ,要执行的EXE在c:\test1.exe,具体命令及结果如下:

上图中的异常提示说,在非用户交互模式下不可以打开模态对话框或者form程序(我要调用的test1.exe是对话框类型的)。所以我们执行命令时要指定用户交互模式,加上“-i”。如下:

然后,远程EXE就调用成功了。读者可以根据自己需要,加上不同的参数,来使用psexec执行一些远程命令。

远程执行命令的psexec工具的基本使用——简单、强大相关推荐

  1. Windows远程执行命令

    环境:Win10.Win7虚拟机 Windows远程命令执行 1.psexec.exe远程执行命令 psexec \\192.168.30.128 -u Administrator -p 123456 ...

  2. 执行远程linux命令,linux shell 远程执行命令

    经常要部署多台服务器上面的应用,如果一个个机器的登录太麻烦. 所有就想到编写一个脚本来部署不同的服务器 前提条件: 配置ssh免登陆 如果不会的请参加我的另外一篇文章 http://blog.csdn ...

  3. Linux 实操———— Shell 远程执行命令

    引言 目前,开发人员的部署方式是,将项目打包(Maven 打包) 然后将 生成的 jar 包等文件,通过Xshell 等终端工具手动传输到远程服务器上,然后再通过在终端执行远程服务器上的 shell ...

  4. 【linux】ssh 远程执行命令

    1.概述 转载并且补充:ssh 远程执行命令 SSH 是 Linux 下进行远程连接的基本工具,但是如果仅仅用它来登录那可是太浪费啦!SSH 命令可是完成远程操作的神器啊,借助它我们可以把很多的远程操 ...

  5. PowerShell 远程执行命令

    PowerShell 远程执行命令 https://www.cnblogs.com/wanghao4023030/p/11151099.html 最近在做一些自动化的测试工作,在代码实现的过程中需要远 ...

  6. 【shell】Linux Shell远程执行命令

    目录 shell远程执行 前提条件: 对于简单的命令: 对于脚本的方式: SSH命令格式 主要参数说明 ssh控制远程主机,远程执行命令步骤 准备工作 基于公私钥认证远程登录可能存在的不足 ssh 执 ...

  7. ssh 远程执行命令

    SSH 是 Linux 下进行远程连接的基本工具,不光可以登录,也可以远程操作.接下来我们详细讲解一些常用的情况. 1.执行简单的命令: 1)查看某台主机上的磁盘使用情况: $ ssh root@1. ...

  8. ansible介绍、安装、远程执行命令、拷贝文件或目录、远程执行脚本、管理任务计划、安装包和管理服务、playbook、变量、循环、条件判断、handlers、安装nginx、管理配置文件

    24.15 ansible介绍 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric)的优点,实现了批量系 ...

  9. Linux之SSH远程执行命令

    注: 部分概念介绍来源于网络 SSH 是 Linux 下进行远程连接的基本工具,不光可以登录,也可以远程操作. 一.执行简单的命令: ssh root@127.0.0.1 "df -h&qu ...

最新文章

  1. 【Qt】使用QPalette设置按钮颜色时,不生效
  2. C语言Prims求最小生成树MST的算法(附完整源码)
  3. python循环嵌套的外循环必须完全包含内循环_Python:循环与嵌套循环实现规律数列...
  4. web service基础知识
  5. asp.net core系列 37 WebAPI 使用OpenAPI (swagger)中间件
  6. 提现php防刷,PHP简单的防刷计数器–已经图片化
  7. php判断长度函数是,php判断字符串长度 strlen()与mb_strlen()函数
  8. scrum角色及其职责介绍
  9. MySQL(9)-----多表创建及描述表关系(需求)
  10. 信息论的基本概念和熵的计算
  11. IDEA maven的安装与配置(超详细)
  12. 软考-中级-网络工程师-知识点个人总结(八)
  13. 求若当标准型的变换矩阵
  14. java微信公众号上传永久素材_微信开放平台永久素材视频文件上传
  15. 大话设计模式之爱你一万年:第三章 创建型模式:工厂模式:我想让你坐在宝马里笑:5.工厂模式之抽象工厂模式
  16. 中国大学mooc中JAVA的答案_中国大学mooc2020Java程序设计题目答案
  17. 最新县及县以上行政区划代码(截止2016年7月31日)
  18. 计算机毕业设计Java酒店管理信息系统(源码+mysql数据库+系统+lw文档)
  19. 斯坦福2021秋季·实用机器学习【中文】【合集】+1.1课程介绍
  20. 重要性采样和多重重要性采样在路径追踪中的应用

热门文章

  1. Hibernate QBC与QBE
  2. (17)QBC、QBE
  3. Buu-crypto-write up
  4. 移动磁盘使用驱动器中的光盘之前需要格式化数据如何恢复
  5. 动态半导体ram依据什么存储信息_静态ram和动态ram的区别是什么
  6. blablabla...
  7. Android权限大全 (android.permission)
  8. WangEditor增加附件上传功能
  9. Python学习1--Python基础
  10. 频谱仪测试gsm信号测试软件,浅谈GSM ORFS输出频谱测试