PutFiles() access is denied in powershell but batch and gui works (solution)

Advertisement

m.w35tin
Guest

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.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum