Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Cppy-Item Does Not Work!

$
0
0

I intend to copy files from server A to server B using Copy-Item but it did not work!

1. I have rights to both server A and server B. I can either map with UNC \\server\sharename or map with windows explore and assign a driver letter (Driver Letter):\sharename.

So, I map server A as L:\sharename and server B as O:\sharename!

I tested copy files with XCopy L:\sharename O:\ /e /h /y (just O: because I map directly to the destination folder). The Xcopy ran successfully!

I use Copy-Item in powershell (yes, run as administrator) and run from PS command line

PS C:\Windows\system32> copy-item -Path L:\sharename -Destination O:\sharename -recurse

The result "A drive with the name 'O' does not exit! and also the same with driver letter L

I did re-run as

copy-item -Path \\servername\sharename -Destination\\servername\sharename -recurse

PS seems to run....It gave mouse cursor blinking and return to PS command prompt without any message to indicate whether it ran successfully or failed.

I checked the destination and nothing copied over!

My questions are:

1) how do I use powershell to copy files with a sign drive letter. Copy from L:\sharename to O:\sharename?

2) What I missed in this PS command? copy-item -Path \\servername\sharename -Destination \\servername\sharename -recurse

I am learning powershell, please be very detail in your respond. I am much appreciate for your help!


Thang Mo


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>