Apologies if this has already answered directly or indirectly in SF.
My requirement will be as follows:
- Move a deployment folder that has got files and subdirectories to a remote sever.
- Pass credentials that will be required for the remote server.
I used 'Start-BitsTransfer' and 'copy-item' commands along with 'new-pssession' but I was not able to transfer the files successfully. All the errors that I get is the path is not found (remote server) or something to do with authentication going bad.
Kenny's answer did solve the above problem, but now I am facing a new issue. The below script works for the first time while connecting to the remote server. Now, if I reuse the script by only changing the remote server to another servername, then I get the below error:
Exception calling "MapNetworkDrive" with "5" argument(s): "The local device name has a remembered connection to another network resource.
" At line:20 char:1 + $net.mapnetworkdrive("F:", "\NEWSERVERNAME01.COM\share\", "true", ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ComMethodTargetInvocation "
Any idea on how to get through the above error ?