I know that the Send-MailMessage has been deprecated but i have not found an alternative. until i do, the problem that i am having is the Changed event that fires (twice) on a file creation. just need to know that this is the default behavior and can’t be changed. below is my snippet on the event.
Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action2
so the default folder that it is looking at is W:\PO Files. what is working is the Created event. that fires (once) when the file is created so if i comment out the Changed event, then everything works and only one email is sent to me.
however if i uncomment out the Changed event and then create a file in PO Files, then Send-MailMessge sends out three emails, one for the Created and two for the Changed. Was hoping that the Changed event was only for files that were updated (meaning that they were previously created, and then a new version was saved, thus firing of the Changed event). did the requisite google search and couldn’t find any valuable info on the Changed event.
Can someone shed some light on this?