PsExec - Windows Sysinternals

Introduction

Utilities like Telnet and remote control programs like Symantec's PC Anywhere let you execute programs on remote systems, but they can be a pain to set up and require that you install client software on the remote systems that you wish to access. PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec's most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems.

Note: some anti-virus scanners report that one or more of the tools are infected with a "remote admin" virus. None of the PsTools contain viruses, but they have been used by viruses, which is why they trigger virus notifications.

Installation

Just copy PsExec onto your executable path. Typing "psexec" displays its usage syntax.

Using PsExec

See the July 2004 issue of Windows IT Pro Magazine for Mark's article that covers advanced usage of PsExec.

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]

computer Direct PsExec to run the application on the computer or computers specified. If you omit the computer name PsExec runs the application on the local system and if you enter a computer name of "\\*" PsExec runs the applications on all computers in the current domain.
@file Directs PsExec to run the command on each computer listed in the text file specified.
-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 then the application must be in the system's path on the remote system.
-d Don't wait for application to terminate. Only use this option for non-interactive applications.
-e Does not load the specified account's profile.
-f Copy the specified program to the remote system 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.
-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 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 the remote computer).
-x Display the UI on the Winlogon 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.
program Name of the program 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.

If you omit a username the remote process runs in the same account from which you execute PsExec, but because the remote process is impersonating it will not have access to network resources on the remote system. When you specify a username the remote process executes in the account specified, and will have access to any network resources the account has access to. Note that the password is transmitted in clear text to the remote system.


Examples

This article I wrote describes how PsExec works and gives tips on how to use it:

The following command launches an interactive command prompt on \\marklap:

psexec \\marklap cmd

This command executes IpConfig on the remote system with the /all switch, and displays the resulting output locally:

psexec \\marklap ipconfig /all

This command copies the program test.exe to the remote system and executes it interactively:

psexec \\marklap -c test.exe

Specify the full path to a program that is already installed on a remote system if its not on the system's path:

psexec \\marklap c:\bin\test.exe

Run Regedit interactively in the System account to view the contents of the SAM and SECURITY keys::

psexec -i -d -s c:\windows\regedit.exe

To run Internet Explorer as with limited-user privileges use this command:

psexec -l -d "c:\program files\internet explorer\iexplore.exe"

 

Download

Download PsTools
(1.60 MB)

 


Home page: http://technet.microsoft.com/en-US/sysinternals/bb897553.aspx

PsExec的用法如下:      1)psexec   usage: psexec \computer [-u username [-p password] [-c [-f] [-i][-d] program [arguments]      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进程,(到底什么用弄不明白) @file 用于针对文本文件中所指定的所有计算机运行该命令(下同)      假设我在远程机器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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值