none
FTP using TLS via Powershell combined with age monitor RRS feed

  • Question

  • Hello,

    What I am trying to do is connect to an FTP site that uses TLS encryption via PowerShell and once I am connected I want it to view that file age and if files have been in the directory for more than 20 minutes an email is sent to a distribution group (management).

    Where I am at so far is importing the PSFTP module from Microsoft and I am able to set-ftpconnection with -enablessl and -ignore cert, but the session closes right away. 

    ContentLength           : -1
    Headers                 : {}
    SupportsHeaders         : True
    ResponseUri             : ftp://xxx
    StatusCode              : ClosingData
    StatusDescription       : 226 Transfer complete. 138 bytes transferred. 138 bps.
                              
    LastModified            : 1/1/0001 12:00:00 AM
    BannerMessage           : 
                              
    WelcomeMessage          : 230 Login OK. Proceed.
                              
    ExitMessage             : 221 Service closing control connection.
                              
    IsFromCache             : False
    IsMutuallyAuthenticated : False
    ContentType             : 

    Any suggestions would be great.

    Monday, September 28, 2015 5:39 PM

Answers

  • Yes.  That is the way it works.  Your connection has been set for all subsequent commands.  FTP always opens and closes a connection on each command.  The classic "open" is just a logical open to set authorization and defaults.


    \_(ツ)_/

    • Marked as answer by td1ddy Tuesday, September 29, 2015 5:01 PM
    Monday, September 28, 2015 6:45 PM

All replies

  • Hi,

    Questions should go on the QandA tab of the gallery item:

    https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb

    This isn't an official Microsoft module, so you'll likely need to go through the author for more help.


    Monday, September 28, 2015 5:58 PM
  • Yes.  That is the way it works.  Your connection has been set for all subsequent commands.  FTP always opens and closes a connection on each command.  The classic "open" is just a logical open to set authorization and defaults.


    \_(ツ)_/

    • Marked as answer by td1ddy Tuesday, September 29, 2015 5:01 PM
    Monday, September 28, 2015 6:45 PM
  • Set-FTPConnection -Credentials $ftpcred -KeepAlive -Server ftp -Session MyFTPSession -enablessl -ignorecert -UseBinary -UsePassive 

    Was missing the -keepalive

    Tuesday, September 29, 2015 5:03 PM