我希望能够在我拥有管理权限的远程计算机上运行WinDirStat,但它不起作用。
这就是我所做的:
以管理员身份运行CMD:
psexe.exe -i -s cmd.exe
从新提示中:
psexec.exe \\host -u username winddirstate.exe
我键入了我的PW并且没有启动
两者都运行Windows 7 Enterprise。
答案 0 :(得分:0)
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][-<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.
-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).
-arm Specifies the remote computer is of ARM architecture.
-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 suppresses the display of the license dialog.
-nobanner Do not display the startup banner and copyright message.
首先,您在Psexec的同一目录中或在环境路径中设置PSexec的路径,然后输入此命令
psexec.exe \ host -u用户名-p密码-s cmd / C C:\ full_remote_path_of_ \ windirstat.exe
OR
在您的远程计算机中放入一个bat文件,例如C:\ abc \ run.bat并将此代码放入其中
并从本地
运行命令以下命令将运行远程上存在的bat文件
psexec.exe \ host -u用户名-p密码-s cmd / C“ C:\ remote \ run.bat”
OR
不需要将run.bat文件放在仅放在本地的远程计算机上,然后给出以下命令
psexec.exe \ host -u用户名-p密码-s -i -c -f“ C:\ local \ run.bat”
OR
psexec.exe \ host -u用户名-p密码-s -i -c -v“ C:\ local \ run.bat”
-s ----->as a Administrator
-i ----->Interactive
-c ----->copy run.bat to remote
-f -----> if run.bat already exist on remote Computer
-v -----> if higher version on local and lower version on remote then it
will copy otherwise not
使用文件名
如果要在许多远程计算机上运行,并且所有远程计算机的用户名和密码都相同,那么放一个文件(例如host.txt)并逐行放入所有ip,在线开始没有空格,然后给出以下命令,将连续运行
PsExec.exe @C:\ full_path \ host.txt -c -s -u用户名-p密码run.bat
**在所有远程计算机上并行运行**
如果要并行运行,则再提供一个参数-d,它将等到完成后再等待过程完成,您可以使用for循环并将PSexec命令放入其中
将结果保存到三个变体形式的某个文件中
**First Variation**
下面将在远程系统中复制iname.bat文件并执行它,并将结果保存到我们正在运行PSexec的本地计算机目录中的success.txt中。
PsExec.exe \ remote_ip -u用户名-p密码-c -f“ iname.bat”>成功.txt
**Second Variation**
下面将运行远程计算机上存在的test.bat并在本地计算机上运行Success.txt
PsExec.exe \ remote_ip -u用户名-p passowrd cmd / C“ C:\ abhi \ test.bat”> success.txt
**Third Variation**
这将运行远程计算机上存在的test.bat并使远程计算机上的Success.txt PsExec.exe \ remote_ip -u用户名-p密码-i cmd / C“ C:\ abhi \ test.bat> C:\ abhi \ success.txt”