psexec to copy files form remote server to local machine

I want to use psexec  and get all files from server 111.11.1.11(dummy) ip address  and file location D:\Myfiles\archive\ on that server.
I want to copy and delete or move all files from that server to my C:\downloadedfiles folder.
Please help...I want to write a .bat file that i can call from another program
Angela4evaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

NVITEnd-user supportCommented:
Put this in your .bat file:
psexec cmd /c "copy \\111.11.1.11\D$\Myfiles\archive C:\downloadedfiles"

Open in new window

Angela4evaAuthor Commented:
I also have username and password for the remote host. Ca you please let me know where I need to enter taht?
Angela4evaAuthor Commented:
psexec -u "username" -p "pwd11"  cmd /c "copy \\111.11.1.11\D$\Myfiles\archive C:\downloadedfiles"
this is what I did
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

arnoldCommented:
Not sure why you think you need to use psexec where robocopy might do the trick?

The references do not include whether the user you provide has the requisite access rights to both locations.
 The credentials might have access on one side while being denied access on the other side since it seems that you will be relying on administrative shares to access c$ and d$ based location on separate systems.
NVITEnd-user supportCommented:
Does it work?
Angela4evaAuthor Commented:
not its says bad user name or password but when i
psexec \\11.1.1.1.1. -u username -p "pwd11"  ipconfig
above lien works but not the copy
Angela4evaAuthor Commented:
arnold,
Can I create a .bat file with above like command using robocopy. I do not ahve a prefrence as long as I can put teh cmd in .bat file and call from another program.
NVITEnd-user supportCommented:
Do this. It is similar to my last post but does a DIR. It opens a separate CMD window. If username has rights to folder, D:\Myfiles\archive, you should see the files:

psexec -u "username" -p "pwd11"  cmd /k "dir \\111.11.1.11\D$\Myfiles\archive"

Open in new window

NVITEnd-user supportCommented:
Without the rights to see D$, it doesn't matter if you use psexec or robocopy.
Angela4evaAuthor Commented:
It still says bad username/password, but the thing is I am able to rdp on this server using the same username and password
arnoldCommented:
Accessing the system is one thing, accessing the administrative shares requires a higher level of rights.


your best bet is to use RDP to the remote server while attaching your local system drives.  
Then you can use a command window on the remote
robocopy d:\Myfiles\Archive \\tsclient\c\downloadedfiles /E /L
To copy them.
NVITEnd-user supportCommented:
If I recall correctly, RDP rights are separate from admin rights, which you need in this case.

Can you access the folders by NOT using the drive letter, i.e. by creating a share? If that is an option, do that instead.

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
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
Windows Batch

From novice to tech pro — start learning today.