Hello, i have written a Powershell script that produces a .csv report in the folder C:\Temp of the remote Windows node then i have to copy it in a shared network folder (eg. \\sharednetwork\testfolder)
When i try to copy it i get access denied error:
[ERROR ] Execution finished with the following error (winrm-exec.py:378)[root]
[ERROR ] Copy-Item : Access is denied
At C:\WINDOWS\TEMP\79-357-N2ASVIL-AS-dispatch-script.tmp.ps1:26 char:1
+ Copy-Item -Path $csvFilePath -Destination $networkPath -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Copy-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.CopyItemCommand
(winrm-exec.py:379)[root]
Failed: NonZeroResultCode: [WinRMPython] Result code: 1
It's strange because the user which i run the script in Rundeck is administrator in the remote node and has rights to write files in the shared network folder.
If i open a Powershell shell directly in the remote Windows node and give the exact same command it works fine.
I also tested to open the path \\sharednetwork\testfolder directly in the Windows file manager from the remote Windows node and have no issues.
Any ideas?
Thanks in advice.