1

I need a way to copy file to local disk from a remote PC using Powershell v2.0, trying with admin rights of that remote PC. By means of below cmdlet we can copy a file:

Copy-Item -Path C:\somefile.txt -Destination c:\someotherfile.txt

But my question is how to specify my local PC path as Destination path or the remote PC path as the source path in the above cmdlet? How to specify UNC Path for source or destination paths in above cmdlet?

  • 1
    You can use something like this Copy-Item -Path 'C:\somefile.txt ' -Destination '\\targetserver\someotherfile.txt$'. – CodeIt Jan 18 '18 at 11:47
  • 1
    Do you have to use the above cmdlet?? Robocopy could be a good answer for what you're attempting? – Ciaran McKenzie Jan 18 '18 at 12:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.