• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1238
  • Last Modified:

PSEXEC with file (@list)


I want to use PSEXEC with a file that has a list of computers.
The problem is that each computer has a diffrent User-Name and password.
Can it be done?
What is the format of the file?
  • 2
1 Solution
Mark DamenERP System ManagerCommented:

I think the @file for PSEXEC is a simple plain text list of PCs, I dont think you can specify credentials in it.  If this is something that you will be using a lot, I would personally create an account on all of the PCs you are trying to target which is the same, and set the same password.

You can remote to these machines using Computer Managment.  Open Computer Management and then Right click on the Top level node, and select to control another PC.

VapiSoftAuthor Commented:
I will wait to see if there is no other reply (that tells me that I can add user-name and password) and if not I will (regrettably) accept this reply.
Farhan KaziSystems EngineerCommented:
Copy and paste attached script into notepad and save it with any name having .cmd extension.
This script requires 'Computers.txt' file on location a from where you are running this script.
Computer.txt file should be semicolon delimited like:


Inside script you need to change the process name that you want to execute with PSExec.exe on remote system (in example I have used Calc.exe).

Hope this helps!

SET FileName=Computers.txt
IF NOT EXIST "%FileName%" ECHO "%FileName%" File not found. &EXIT /B 0
FOR /F "tokens=1-3 delims=;" %%a IN ('TYPE %FileName%') DO (
	ECHO Processing: %%a
	PING -n 1 -w 1000 %%a|Find /I "TTL" >NUL
		C:\PSTools\PSExec.exe \\%%a -u %%b -p %%c -d Calc.exe
	)ELSE (ECHO Unable to connect %%a: system may be offline.&ECHO.))

Open in new window

VapiSoftAuthor Commented:
The problem is it is not realy using the @file attribute but just does many PSEXEC commands. But I understand that this is the only solution for this problem. Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now