PSEXEC

Can anyone tell me how can I list Directories and files on a remote computer using PSEXEC?

I issue the following commands :

PSEXEC \\remote_computer\ dir c:\

It returns with an error : "The system can not find the file specified"

Dir is a DOS Shell command and built into command.com or OS Shell.

Does PSEXEC retreives/interprets with DOS/Windows Internal commands?

Thanks!
LVL 35
Nirmal SharmaSolution ArchitectAsked:
Who is Participating?
 
Jeff BeckhamEngineerCommented:
The command "psexec \\<remote_computer> cmd.exe /c dir" works for me.  If you're having authentication problems, you should be able to use either the -s flag or -u in combination with -p.
0
 
NacMacFeegleCommented:
I confused as to why you would want to use psexec to list the files? Could you not use dir \\remote_computer\c$ from a command prompt?
~
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
I know I can use above commands...I just have an query regarding how PSEXEC interacts with DOS internal commands since they are not created physically but exists logically.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
David LeeCommented:
Greetings, SystmProg.

Since DIR is an internal command you have to call Command.com and pass it parameters.  Something like this:

PSEXEC \\remote_computer c:\windows\system32\command.com /c dir c:\

Cheers!
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
Well, I'm not sure if that command works or not but it looks like it should work.

BTW: when I run the above command I get the following error:

login failure or bad password.

I have tried using -u user_name and -p password but to no avail.
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
Ok the above command runs without any exit code 0 but doesn't list anything...

It should list Directories of remote computer....I have also tried using > file_name.txt
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
Not command.com but CMD.exe.

Thanks for putting me on right track.
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
BTW: I don't have authentication problem. I'm specifying NetBIOS name of computer name. I should put FQDN so that authentication can be handled by Kerberos.

NetBIOS leads to broadcast - sometimes it is able to authenticate and sometimes not.
0
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.

All Courses

From novice to tech pro — start learning today.