I have a requirement to copy a file from a local machine to a remote machine using PowerShell. I can copy the file to a remote computer using the following command:
copy-item -Path d:\Shared\test.txt -Destination \\server1\Shared
the above command uses a network shared path to copy a file. I do not want to use a network resource, since the folder will not be used on the remote computer. I tried the following commands but did not work.
copy-item -Path d:\Shared\test.txt -Destination \\server1\c$\Shared Invoke-Command -ComputerName \\server -ScriptBlock { copy-item -Path D:\Shared\test.txt -Destination C:\Shared }
Please let me know how to make it work without using a UNC path. I have full permissions on this folder on the remote machine.
source share