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.