copy files and send a report following it.
Paylease.bat
“C:\Program Files (x86)\WinSCP\WinSCP.com” “/script=c:\scripts\site1_WinSCPscript.txt” /log=”D:\Apps\hms\deploy\site1.log”
move D:\Apps\hms\deploy\site1\* D:\Apps\hms\deploy\site1.Archive\
if %ERRORLEVEL% neq 0 goto errorpowershell -command “c:\scripts\mailer_success.ps1″exit /b 0:errorpowershell -command “c:\scripts\mailer_failure.ps1″exit /b 1
The mailer successful powershell command
mailer_success.ps1
$EmailFrom = “user1@ftp.site1.com”
$EmailTo = “notify@consco.net,user2@consco.org”
$Subject = “site1 FTPs transfer success”
$Body = “The FTPs transfer appears to have finished properly, for details please check the log file on site1-server.”
$SMTPServer = “192.168.0.12″
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
$SMTPClient.EnableSsl = $false
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Mailer_failure.ps1
$EmailFrom = “user1@ftp.site1.com”
$EmailTo = “custalarm@consco.net,user2@consco.org”
$Subject = “site1 FTPs transfer failed”
$Body = “The FTPs transfer appears to have failed, for details on the failure please check the log file on site1-server.”
$SMTPServer = “192.168.0.12″
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
$SMTPClient.EnableSsl = $false
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Now to the winscp script
option batch on
option confirm off
open -explicitssl -passive ftp://username:password@ftp.site1.com
option transfer binary
put D:\Apps\hms\deploy\site1\*
close
exit