PutFiles() access is denied in powershell but batch and gui works (solution)
I'm moving from a legacy batch file to a powershell script and ran into an issue when trying to execute $transferResult = $session.PutFiles($localPath, $remotePath), I kept getting access is denied. I triple checked my $sessionOptions and everything was correct. After hours of debugging turns out that I was missing a / in the $remotePath variable...
So this:
$remotePath = "/destinationFolder",
Needed to be this:
$remotePath = "/destinationFolder/",
Hope somebody finds this useful in the future.
So this:
$remotePath = "/destinationFolder",
Needed to be this:
$remotePath = "/destinationFolder/",
Hope somebody finds this useful in the future.