I am trying to use FTP in Powershell to upload a file. I use FtpWebRequestlater and then GetRequestStream, but this method returns an error:
"The requested FTP command is not supported when using the HTTP proxy."
I really am for the proxy and should be.
How can I load through Powershell when behind a proxy?
This will only be done with a .ps1Powershell script.
I also tried:
$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($server)
$webclient.UploadFile($uri, "C:\Test\1234567.txt")
Where $serverand this file are valid. But this 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 backslash in files, didn't help.
The proxy I'm connected to applies only to HTTP, not FTP.
source
share