How do I run a batch file remotely using PsExec?

How do I run a batch file remotely using PsExec?

PsExec allows you to run the command simultaneously on multiple remote computers. To do this, you can set the computer names separated by commas: psexec PC1,PC2 “ipconfig /all” or save them in a text file, and then specify a path to this file: psexec @c:\ps\computer_list. txt ipconfig.

How do I run a batch file on a remote computer?

Run cmd, launch “C:\pstools\psexec.exe ser-pc -u domain\admin -p password cmd /k”, it goes into CMD on a remote computer. Then i type “start \share\script. bat” and it launches my batch file.

How do you write and run a batch file?

Open a text file, such as a Notepad or WordPad document. Add your commands, starting with @echo [off], followed by, each in a new line, title [title of your batch script], echo [first line], and pause. Save your file with the file extension BAT, for example, test. bat.

Does PsExec need to be installed on remote machine?

Installing PSexec (With Remote Computer Setup) Technically, you don’t install PsExec since it’s just a command-line utility but close enough. Since no installation is necessary, you simply need to download and extract it from the PsTools zip file.

How do I run Psexec?

How to Set Up PsExec

  1. Enter firewall. cpl in the Run dialog box.
  2. Select Allow an app or feature through Windows Firewall from the left side of the window.
  3. Make sure File and Printer Sharing has a checkmark in the Private box to its right.
  4. You can now exit any open Windows Firewall settings.

How do I run Psexec as system?

Show activity on this post.

  1. Download psexec.exe from Sysinternals.
  2. Place it in your C:\ drive.
  3. Logon as a standard or admin user and use the following command: cd \ .
  4. Use the following command: psexec -i -s cmd.exe where -i is for interactive and -s is for system account.

Can PSExec run a batch file on a remote host?

I am experimenting with PsExec and I am trying to run a batch file on a remote host from a local PC on the same LAN. The batch file has been tested on the local PC and works fine.

How to copy a file using PSExec?

Using PSexec for simply copying the files is pointless. This command, run by domain admin, will do: Or, to make use of pc list file: for /f %a in (pclist.txt) do copy /y \\server\\share\\file.msi \\%a\\c$\\

How does PSExec work on multiple computers?

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.

How to restart a remote computer using PSExec?

To restart the remote computer, run the following command: If you need to run several commands one by one, it’s better to run the PsExec in the interactive mode on the remote computer. To do this, run the command: Now all the commands that you typed in the command prompt on your local computer, will be executed on the remote lon-srv01 computer.