I have the need to run a Powershell command on a remote computer that will move a file from the remote computer to another computer on the network.
PS H:\> invoke-command -computername server1 -scriptblock {move-item c:\jobs\archive\A1051626.zip "
\\FilerServer\jobs\archive\"}
This command results in the following error:
Access to the path is denied. + CategoryInfo : PermissionDenied: (C:\jobs\archive\A1051626.zip:FileInfo) [Move-Item], Unauthorized AccessException + FullyQualifiedErrorId : MoveFileInfoItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.MoveItemCommand
If I edit the PS command to copy the file to a local system folder the command runs fine.
The user account that I am running the PS script from on my local computer has permissions to copy files to the remote file server. I have double checked this, and I can mannually copy the files to the file share from Windows Explorer.
What is preventing the copy operation in PowerShell? How can I get this task to run?
Thanks!