question

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT asked 58214058 answered

FTP Download PowerShell Script

I am attempting to download a file from an ftp site, but am getting an error from the script:
12641-%E6%89%B9%E6%B3%A8-2020-07-16-105724.png
The error is:

Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (530) Not logged in."
At ps1:15 char:1
+ $FTPResponse = $FTPRequest.GetResponse()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException

Any help would be greatly appreciated.


windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YoungYang-MSFT avatar image
0 Votes"
YoungYang-MSFT answered

Hi,


From the Error message: The remote server returned an error: (530) Not logged in.


I recommend checking the username and password very carefully. In many ftp servers, the username and password are case sensitive.


Please let us know if you would like further assistance.


Best wishes.


Young Yang

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

43863280 avatar image
0 Votes"
43863280 answered 43863280 published

.Requesting a Cloud Shell.Succeeded.
Connecting terminal...

Welcome to Azure Cloud Shell

Type "az" to use Azure CLI
Type "help" to learn about Cloud Shell

azureuser@Azure:

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

58214058 avatar image
0 Votes"
58214058 answered

@IanXue-MSFT - You need to convert password to secure string before creating credential object like below

 $Secpwd = ConvertTo-SecureString $password -AsPlainText -Force
 $FTPRequest.Credentials = New-Object System.Net.NetworkCredential($UserName,$Secpwd)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.