PSEXEC with file (@list)

Hi,

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?
VapiSoftAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark DamenERP System ManagerCommented:
Hi

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.

Mark.
0
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.
0
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:

ComputerName;Username;password

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!
Farhan

@ECHO OFF
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
	IF NOT ERRORLEVEL 1 (
		C:\PSTools\PSExec.exe \\%%a -u %%b -p %%c -d Calc.exe
	)ELSE (ECHO Unable to connect %%a: system may be offline.&ECHO.))
EXIT /B 0

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.