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

Using Copy-Item to overwrite files in remote server directory

$
0
0

Hello,

I am trying to copy newer files over older files from my workstation to a server using the copy-item cmdlet.

The cmdlet looks something like this:

copy-item *.* \\servername\c:$\pathname -force

There are no subfolders involved, so -recurse is not necessary.

When I run the command, I get this:

Copy-Item : Access to the path <Destination> is denied.

At line:1 char:1

+ Copy-Item '<source file>' '<Destination>

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Copy-Item], UnauthorizedAccessException

    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.CopyItemCommand

I am running with administrative credentials at both ends of the network path AND I can use the GUI to copy and paste the files using Windows Explorer.  I am losing hair due to scratching my head.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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