My requirement is to copy the data files from my internal server to a remote third party file-share server on a daily basis.(site to site VPN is configured)
Welcome to the forums.
when you post code, error messages, sample data or console output format it as code, please.
Here you can read how that works: Guide to Posting Code.
You can go back and edit your existing post. You don’t have to create a new one.
Thanks in advance.
If that’s a daily task I’d consider to set up a scheduled task and set it up to run this task with the credentials you need to access the remote server. This way you don’t need to care about the credentials inside the script and you can use UNC paths instead of error prone drive letters.
Regardless of that: Windows Server 2008R2 is out of support for more than 1 year. You should urgently update to a supported version.
I have noticed that using PowerShell remotely against an IP address instead of a name has forced me to pass credentials. Can you use the DNS name instead of the IP address to the destination?