ComponentPro UltimateFtp

      Using UltimateFtp in PowerShell

      Language Filter: AllSend comments on this topic to ComponentPro

      With only few steps, you can easily and quickly use UltimateFtp component in PowerShell as described below:

      Loading assembly

      To load UltimateFtp component for using in PowerShell, simply use the [Reflection.Assembly]::LoadFrom command as demonstrated below:

      PowerShell - Loading Assembly
      PS C:\> [Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\ComponentPro\UltimateFtp vX.X.X.X\Bin\Net\ComponentPro.Ftp.dll")

      Loading the assembly from GAC

      PowerShell - Loading Assembly from GAC
      PS C:\> [Reflection.Assembly]::LoadFrom("ComponentPro.Ftp, Version=X.X.X.X, Culture=neutral, PublicKeyToken=0efede2d78b28dff")

      Using Ftp class

      Now you are ready to use all classes inside the UltimateFtp component. For example, to Connect, Authenticate and Download a file from a server, you can use the following script:

      PowerShell - Using ComponentPro.Ftp
      PS C:\> $client = New-Object ComponentPro.Net.Ftp
      PS C:\> $client.Connect("myserver")
      PS C:\> $client.Authenticate("user", "pass")
      PS C:\> $client.DownloadFile("/test.dat", "c:\temp\test.dat")
      PS C:\> $client.UploadFile("c:\temp\test.dat", "/test2.dat")
      PS C:\> $client.DeleteFile("/test2.dat")
      PS C:\> $client.Disconnect()
      PS C:\> $client.Dispose()