I need a script to help me for uploading a single file, to a cloud.
I found some answers with the protocol SFTP (SSH), but I cannot find a script working with FTPS (SSL).
I have tried this script, but it doesn't work:
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.ParseUrl("**ftps**://**login**:**password**@**ipoftheremoteserver**:990/")
$session = New-Object WinSCP.Session
$session.Open($sessionOptions)
$session.PutFiles("D:\QAPPLI\Quadra\DATABASE\PAIE\000001\qpaie.mdb", "/FOLDER1/08h00").Check()
$session.Dispose()
I have this error:
PS C:\Windows\system32> D:\Script\08h00_000001_Client1_to_ftps.ps1 Exception lors de l'appel de « Check » avec « 0 » argument(s) :
« Erreur lors du transfert du fichier 'D:\QAPPLI\Quadra\DATABASE\PAIE\000001\qpaie.mdb'. Server sent passive reply with unroutable address 172.16.59.131, using host address instead.
Copie de fichiers vers le coté distant échouée.
Filename invalid
Au niveau de D:\08h00_000001_Client1_to_ftps.ps1 : 8 Caractère : 85 + $session.PutFiles("D:\QAPPLI\Quadra\DATABASE\PAIE\000001\qpaie.mdb", "/FOLDER1/08h00").Check <<<< () + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
Translated to English:
D:Script08h00_000001_Client1_to_ftps.ps1 Exception when calling "Check" with "0" argument (s): «"Error transferring file ' D:QAPPLIQuadraDATABASEPAIE000001qpaie.mdb '. Server sent passive reply with unroutable address 172.16.59.131, using host address instead.
Copying files to the failed remote side.
Filename Invalid
at D:08h00_000001_Client1_to_ftps.ps1:8 character: 85 + $session. PutFiles ( "D:QAPPLIQuadraDATABASEPAIE000001qpaie.mdb", "/FOLDER1/08h00"). Check < < < () + CategoryInfo: NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId: DotNetMethodException
Many thanks for your help.