I am attempting to use FTP in Powershell to upload a file. I am using
FtpWebRequest later followed by
GetRequestStream, but this method is returning an error:
"The requested FTP command is not supported when using HTTP proxy."
I am indeed behind a proxy and required to be.
How can I upload via Powershell when behind a proxy?
This would be solely run from a
.ps1 Powershell script.
I have also tried:
$webclient = New-Object System.Net.WebClient $uri = New-Object System.Uri($server) $webclient.UploadFile($uri, "C:\Test\1234567.txt")
$server and that file are valid. But that code returns this error:
"An exception occurred during a WebClient request." At C:\Test\script.ps1:101 char:26 + $webclient.UploadFile <<<< ($uri, "C:\Test\1234567.txt") + CategoryInfo : NotSpecified: (:) , MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
I also tried double backslashes in the file paths, didn't help.
The proxy I am under only touches HTTP, and not FTP.