Link to home
Start Free TrialLog in
Avatar of rwheeler23
rwheeler23Flag for United States of America

asked on

Powrshell success notifications

I now have about a dozen Powershell scripts using WinSCP that export data and transfer those exports to an SFTP server.  Is there some way to get notification via text or email informing of either success or failure.

Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Is there some way to get notification via text or email informing of either success or failure. 

you probably can write the logs (success, failed, etc) into a db logs, and then use some automated tasks (such as scheduled tasks, control-M jobs, etc) to consolidate and send out the log reports.

if you want to do it once the FTP job is finished, then probably you could send out the email / sms within your powershell scripts.
Avatar of rwheeler23

ASKER

So within the Powershell script I can direct output to a log file? It can just be a text file and then I could email the text file. Can you please supply a sample code snippet?
to write to a file, you could simply refer to Add-Content method

Powershell - Append content to File

https://www.tutorialspoint.com/powershell/powershell_filesio_append.htm
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial