FTP Download PowerShell Script

Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,131 Reputation points Microsoft Vendor
2020-07-16T02:58:38.777+00:00

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
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,322 questions
0 comments No comments
{count} votes

Accepted answer
  1. 2020-07-16T06:01:46.583+00:00

    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

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. 2021-07-08T08:43:03.977+00:00

    .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:

    0 comments No comments

  2. Purna Rao 26 Reputation points
    2021-11-11T18:12:01.447+00:00

    @Ian Xue (Shanghai Wicresoft Co., Ltd.) - 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)  
    
    0 comments No comments