PowerShell FTP Client Module

The PSFTP module allow you to connect and manage the contents of ftp account. Module contain set of function to get list of items, download and send files on ftp location.

PSFTP.zip
 
 
 
 
 
4.5 Star
(107)
50,438 times
Add to favorites
Applications
1/12/2019
E-mail Twitter del.icio.us Digg Facebook
  • FTP over SSL/TLS
    2 Posts | Last post March 02, 2020
    • I would like to use the module for an FTP backup. The FTP uses Explizietes TLS how can I use it? it work via normal FTP but it does not work via TLS what am I doing wrong?
      
      Import-Module PSFTP
      clear-host
      $username = "****"
      $pass = "***"
      $password = $pass | ConvertTo-SecureString -asPlainText -Force
      $credentials = New-Object System.Management.Automation.PSCredential($username, $password)
      Set-FTPConnection -Credential $credentials -Server 'ftp://***' -Session FTP -EnableSsl -ignoreCert -UsePassive
      $Session = Get-FTPConnection -Session FTP 
      $ServerPath = "/backup/"
      $LocalPath  = "c:\temp\"
      $fileList   = Get-FTPChildItem -Session $Session -Path $ServerPath
      foreach ($element in $fileList) {
      $filename = $ServerPath  + $element.name
       Get-FTPItem    -Path $filename -Session $Session -LocalPath $LocalPath -Overwrite $true    }
      
    • the Failour is:
      
      Set-FTPConnection : Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (530) Not logged in."
  • Server 2019?
    2 Posts | Last post January 31, 2020
    • Hello! Has anyone got this to work on a server 2019? Am trying our script from server 2012 to 2019 and am stuck at Set-FTPConnection : Exception calling "GetResponse" with "0" argument(s): "The operation has timed out."
      
      Thanks for any support and best regards, Sven
    • Hi,
      I encounter the same Exception on Windows 2016 standard but not on Win10 Pro
      i will do some other tests
      regards
      
      seb
  • IIS FTP support
    1 Posts | Last post January 22, 2020
    • Hi
      As some has posted before, I'm having an issue with Get-FTPChildItem.
      I don't have access to the server, so I have no clue to what kind of FTP server it is, but I'm guessing IIS FTP.
      
      Seems like the parser can't recognize the format 
      Debug looks like this:
      ..
      DEBUG: Read Line: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <HTML>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <HEAD>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <TITLE>FTP Listing of &#x2F;RTD at ftp.somewhere.com</TITLE>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <BASE HREF="ftp://ftp.somewhere.com/RTD/">
      DEBUG: Filter accepted: *
      DEBUG: Read Line: </HEAD>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <BODY>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <H2>FTP Listing of &#x2F;RTD at ftp.somewhere.com</H2>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <HR>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <A HREF="../">Parent Directory</A><BR>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <PRE>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: Jan 13 2020 08:42     42696009 <A HREF="Another_Releases_Filename_3.118.zip">Another_Releases_Filename_3.118.zip</A>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: Jan 13 2020 12:19     42697930 <A HREF="Another_Releases_Filename2_3.118.zip">Another_Releases_Filename2_3.118.zip</A>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: </PRE>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: <HR>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: </BODY>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: </HTML>
      DEBUG: Filter accepted: *
      DEBUG: Read Line: 
      
      All I'm getting i a list of blank lines where the size of them says B and the name is -
      
      Dir Right     Ln  User   Group  Size   ModifiedDate        Name                
      --- -----     --  ----   -----  ----   ------------        ----                
      -                               B                              
  • How to go up a Dir from home dir
    1 Posts | Last post December 20, 2019
    • Setting a connection works fine.
      However default i come in the /www of the ftp area
      Im using the following code:
      $url = '172.20.143.204'
      $url = "ftp://$url"
      $credentials = New-Object System.Management.Automation.PSCredential($FTPUser, $password)
      Set-FTPConnection -Credentials $credentials -Server $url -Session MyTestSession -UsePassive
      $Session = Get-FTPConnection -Session MyTestSession
      
      The root of this server is:
      /storage
      /www
      /SDK
      
      I want to download something from the storage directory. When i use Filezilla i also come in the /www dir.
      but i can browse to /storage and download files.
      I cant see how I could use the CDUP command and then use the:
      Get-FTPChildItem -Session $Session -Path /storage 
      command to do my stuff
      Also tried:
      Get-FTPItem -Session $Session -Path /storage/myfile.old
      
      
      Im a bit stuck now. It would be great if there was like a do raw command option. CDUP CWD etc.
      In wireshark i keep on getting "Current working directory: /www"
  • Error in example of Set-FTP Connection
    1 Posts | Last post December 17, 2019
    • Hi,
      
      When viewing the file 'Set-FTPConnection.ps1' in the example you refer to using the parameter -credentials. However it should be -credential right? A small thing to correct but since I copy/psated the the example listed there I could not figure out why my connection wasn't working ;)
      
      Greetings,
      Bramqu
  • issue with Add-FTPItem
    1 Posts | Last post November 06, 2019
    • "Add-FTPItem" using call "New-FTPItem" (line 123)
      but without parameter "Session"
      and i take error, because my session name "testSessionName", but "New-FTPItem" try use name "DefaultFTPSession", but its not exist
      
      solution:
      when "Add-FTPItem" call "New-FTPItem" need add parameter "-Session $CurrentSession"
      correct line 123:
      "New-FTPItem -Path $RequestUri -Name $ItemName -Session $CurrentSession"
      
      p.s. sorry for my english
  • TLS
    1 Posts | Last post November 05, 2019
    • Does it support TLS (explicit and implicit)?
  • "Exception setting "Credentials": "Value cannot be null." error
    2 Posts | Last post October 31, 2019
    • Import-Module PSFTP
      $username = "xxx"
      $pass = "xxx"
      $password = $pass | ConvertTo-SecureString -asPlainText -Force
      $credentials = New-Object System.Management.Automation.PSCredential($username, $password)
      $file = "C:\xxx\xxx\test.txt"
      Set-FTPConnection -Credentials $credentials -Server ftp://ftp.xxx.com -Session FTPSession -Usepassive
      $Session = Get-FTPConnection -Session FTPSession 
      Add-FTPItem  -path /invoices -Session $Session -LocalPath $file
      
      I get this error after running the script above:
      
      Exception setting "Credentials": "Value cannot be null.
      Parameter name: value"
      At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSFTP\Add-FTPItem.ps1:150 char:9
      + ...                    $Request.Credentials = $CurrentSession.Credentials
      +                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
          + FullyQualifiedErrorId : ExceptionWhenSetting
      
      All other functions work, except Add-FTPItem. Anybody came across this? 
      
    • Well if you don't have got an answer until now:
      ConvertTo-SecureString needs the passwort as parameter:
      $password = ConvertTo-SecureString $pass -asPlainText -Force
      
  • -Overwrite:$false not working
    1 Posts | Last post July 07, 2019
    • I am unable to get the -Overwrite:$false parameter to work. If I set it to $true then it works and it overwrites every time but what I would like to do is to skip any files that already exist.
      
      Anyone have any clues?
      
      Thanks.
  • TLS 1.2 connections not working
    1 Posts | Last post June 25, 2019
    • If the FTP server is forcing TLS1.2, this module can't connect.
      
      The fix is to install .NET framework 4.61 or up and add these reference types..
      
      Add-Type -Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Net.dll"
      Add-Type -Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.Net.Requests.dll"
1 - 10 of 185 Items