Learn how to a build a cloud-first strategyRegister Now



Posted on 2006-03-22
Medium Priority
Last Modified: 2010-08-05
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?

Question by:Nirmal Sharma

Assisted Solution

NacMacFeegle earned 200 total points
ID: 16255890
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?
LVL 35

Author Comment

by:Nirmal Sharma
ID: 16256066
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.
LVL 76

Assisted Solution

by:David Lee
David Lee earned 200 total points
ID: 16256662
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:\

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 35

Author Comment

by:Nirmal Sharma
ID: 16257631
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.
LVL 35

Author Comment

by:Nirmal Sharma
ID: 16257670
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

Accepted Solution

Jeff Beckham earned 1600 total points
ID: 16258591
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.
LVL 35

Author Comment

by:Nirmal Sharma
ID: 16265931
Not command.com but CMD.exe.

Thanks for putting me on right track.
LVL 35

Author Comment

by:Nirmal Sharma
ID: 16265939
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.

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question