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.6 Star
(98)
40,338 times
Add to favorites
Applications
2/19/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Issue while uploading file through FTP using PSFTP module
    1 Posts | Last post Mon 11:01 PM
    • Hi Guys,
      
      I am facing a issue while trying to upload a file through FTP using PSFTP module which i have highlighted below.  From the error i can find that the FTP location is considering both the source and destination path. I am not sure how to fix this issue. Can someone help me with this.
      
      Code:
      
      Import-Module PSFTP 
      Set-FTPConnection -Credentials username -Server ftp://servername.com -Session MyTestSession
      $FTP = "ftp://servername.com"
      $FTPPath = "C:\Users\username\Desktop\Scripts\FTP\testfile.txt"
      Add-FTPItem -Path $FTP -LocalPath $FTPPath -Session MyTestSession -Verbose
      
      Error output after the FTP connection is established:
      
      VERBOSE: Performing the operation "Send item: 'C:\Users\username\Desktop\Scripts\FTP\testfile.txt' in ftp location" on target "ftp://servername.com/C:/Users/username/Desktop/Scripts/FTP/testfile.txt".
      Add-FTPItem : Exception calling "GetRequestStream" with "0" argument(s): "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)."
      At line:5 char:1
      + Add-FTPItem -Path $FTP -LocalPath $FTPPath -Session MyTestSession -Ve ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
          + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-FTPItem
      Regards
      
      Sathish
  • Awesome module! Can I contribute?
    1 Posts | Last post December 28, 2017
    • Hello Michal! Awesome module and one of the best (if not the only one) that seem to be able to support a lot of things that I was looking for. However, I was wondering if there is a github repository where I can also make contributions and add some functionality that might be useful for others as well.
      
  • Does this module work on SFTP?
    1 Posts | Last post December 13, 2017
    • Does anybody knows if this module also works for SFTP? if so, what is the syntax to call? Thanks!
  • Add-FTPItem requires -Overwrite flag
    1 Posts | Last post December 06, 2017
    • For uploading had to specify the "-Overwrite" flag even though the FTP directory is empty otherwise would get "The remote server returned an error: (550) File unavailable (e.g., file not found" error;
      
      Set-FTPConnection -Credentials $Credential -Server $ftpvip -Session FTPSession -UseBinary -Verbose
      $FTPSession = Get-FTPConnection -Session FTPSession
      
      Add-FTPItem -Session $FTPSession -Path $photo.subfolder -LocalPath $photo.FullName -Overwrite -Verbose
  • Get-FTPChildItem - not recognized as the name of a cmdlet
    2 Posts | Last post December 06, 2017
    • I have downloaded PSFTP a couple of times and all the other cmdlets run fine however every time Get-FTPChildItem is called from another cmdlet or directly from the command line I get an error:
      
      Get-FTPChildItem : The term 'Get-FTPChildItem' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the 
      name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:1
      + Get-FTPChildItem
      + ~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (Get-FTPChildItem:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
       
      
      Everything else works!
      
      PS D:\FTP> Import-module -name $currentFolder\PSFTP
      
      PS D:\FTP> Add-FTPItem
      cmdlet Add-FTPItem at command pipeline position 1
      Supply values for the following parameters:
      LocalPath: 
      
      PS D:\FTP> Remove-FTPItem
      cmdlet Remove-FTPItem at command pipeline position 1
      Supply values for the following parameters:
      Path: 
      
      PS D:\FTP> Set-FTPConnection
      cmdlet Set-FTPConnection at command pipeline position 1
      Supply values for the following parameters:
      Credentials: 
      
      PS D:\FTP> Get-FTPConnection
      
      Session                                      RequestUri                                   User                                         Alive Binary Passive Ssl  
      -------                                      ----------                                   ----                                         ----- ------ ------- ---  
      FTPSession                                   ftp://xxx-xxxx-xxx.xxx.xxxxx... xxx.xx.xxxx                         False True   False   False
      
      
      
      PS D:\FTP> Get-FTPChildItem
      Get-FTPChildItem : The term 'Get-FTPChildItem' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the 
      name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:1
      + Get-FTPChildItem
      + ~~
      
    • got it working, had to add the PSFTP folder to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
      
      Any idea why only this cmdlet failed to load from the local Import-Module? I prefer to keep modules contained with the script rather than having to install on each server:
      
      $currentFolder = split-path -parent $MyInvocation.MyCommand.Definition
      Set-Location $currentFolder
      
      Import-module -name $currentFolder\PSFTP
      
  • Unicode filename character support?
    1 Posts | Last post December 03, 2017
    • Hello,
      Thank you for this GREAT module!!!
      When I use Get-FTPChildItem files with Danish national characters (Æ, Ø and Å), it doesn't read them correctly, but instead like "Ã…" and other misinterpretations.
      How can I specify Encoding?
  • Close Connection
    1 Posts | Last post November 27, 2017
    • Hello Michal,
      I am using PSFTP module to upload file to ftp server while executing build job on appveyor server.
      Here is code:
      Import-Module PSFTP
      $password = $password | ConvertTo-SecureString -asPlainText -Force
      $credentials = New-Object System.Management.Automation.PSCredential($username,$password)
      Set-FTPConnection -Credentials $credentials -Server $server -UsePassive
      Add-FTPItem -Path $path -LocalPath $localpath -Overwrite
      
      File uploads successfully, but after that appveyor is unable to publish artifacts:
      Error uploading artifact the storage: The underlying connection was closed: An unexpected error occurred on a send.
      
      Is there any way to close ftp connection after file was uploaded? Something like "Close-FTPConnection" cmdlet?
      
  • BufferSize issue
    1 Posts | Last post November 23, 2017
    • Just downloaded the latest version and somehow the $BufferSize variable in Get-FTPItem is being set to 1 despite the default value of 20KB or passing in a value.  This results in extremely slow file transfers timeouts when using Get-FTPItem.  Replacing the $BufferSize variable with 20480 (which is what it should be set to anyway?!) and it works fine.
      
      [Byte[]]$Buffer = New-Object Byte[] $BufferSize
      to
      [Byte[]]$Buffer = New-Object Byte[] 20480
      
      The same section of code to instantiate the buffer works ok in isolation.  Very strange issue.
  • File list format
    2 Posts | Last post November 17, 2017
    • I got a list of files using Get-FTPChildItem, but the files properties are empty.
      I checked the code and in Get-FTPChildItem.ps1 i modified regex on line 263 from:
      ...^(\d{2}-\d{2}-\d{2}... to ...^(\d{2}-\d{2}-\d{2,4}... to allow for 4-digit year (which I am getting in my FTP server response).
      It helped and now the files have their properties filled correctly.
    • Hey there, I think I have a similar problem.
      
      I list empty files and can't seem to download them, then.
      
      The dates are in this format Nov 13 2017 16:27
      
      Yet I tried to apply your fix, but it didn't help...
      
      Do you have any idea why ?
  • Is this module available on Github
    1 Posts | Last post October 31, 2017
    • Hi Michal,
      Thank you for writing this module.
      For the past few years whenever i need to work with FTP this module is my first go to solution.
      
      I tried to find this module on github and i couldn't.
      If it's not on Github, I was wondering if you could publish PSFTP to its own repository.
      I would like to fork it and maybe contribute to it. 
      
1 - 10 of 159 Items