Copy From CMD

Govind Parth
Govind Parth used Ask the Experts™
on
Hi

I am trying to copy a directory from the network file share to a remote computer root drive. When i run the copy cmd using the PSTools on the remote computer it throws error saying access denied. However when i file explore the remote computer using C$ and copy it using the GUI it works. Any suggestions ???
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Sam JacobsDirector of Technology Development, IPM
Commented:
Are you passing PSTools your credentials (-u username -p password)?

Commented:
Can you check from the source
\\destination_server\ADMIN$
If you are getting access denied, follow below steps on remote server/pc




Open RegEdit on your remote server
Take a backup of the registry
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Add a new DWORD value called LocalAccountTokenFilterPolicy
Set its value to 1
Reboot the pc/server
Try running PSExec again from your local server
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
Assuming you can access the source from the machine you're running the command on, there's no need to use psexec. Since the GUI and psexec work, the administrative shares are accessible, so you can copy directly to the remote machine.
Sample with robocopy:
robocopy.exe "\\SomeServer\share\folder" "\\SomeMachine\C$\folder" /e /r:0

Open in new window

Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
You cannot compare both methods. What you have done with Explorer corresponds with oBdA's robocopy suggestion - you copy content from remote to your machine to another remote.
Using psExec however performs a direct copy on the remote machine, so you need to make sure to have network access from there (as has been said above).
Remember that with psExec you are just talking to the remote machine, and seeing results of it sends back. No files, drives or whatever are exchanged (after the session started).
Senior Consultant
Awarded 2017
Distinguished Expert 2018
Commented:
To access shares via PSEXEC on remote computer you need -u and -p as per first comment
Govind ParthSystem Administrator

Author

Commented:
Thanks. I figured out yesterday. With the usage of -u switch it worked..Thanks for ur efforts
Shaun VermaakSenior Consultant
Awarded 2017
Distinguished Expert 2018

Commented:
Please mark the first comment by Sam as the answer :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial