PS script to scan folder and email results

I'm not a Powershell guru, so I could use a little assistance.

I'm looking for a PS Script that I can set up in Task Scheduler that will run every 10 minutes. I want it to scan an FTP folder and email me the results of any changes. I have tried one that I found on another site, but even thought it appears to run clean, it never submits the email to my local mail server.

Any help would be greatly appreciated.

Thanks,
Ken
kllarsonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

footechCommented:
If the other one works but just doesn't send the email, go ahead and post it.  It'll save some effort.
kllarsonAuthor Commented:
Here is the script I found on a Spiceworks thread minus my personal changes to server and email. I have attached it as a .txt file.

This is the setup in Task Scheduler.

Start a program:
powershell -ExecutionPolicy ByPass -file "c:\scripts\ScanFolderForChangedFiles.ps1"
Bill PrewIT / Software Engineering ConsultantCommented:
Did you mean to attach something to the prior post?

~bp
Webinar: Cyber Crime Becomes Big Business

The rising threat of malware-as-a-service is not one to be overlooked. Malware-as-a-service is growing and easily purchased from a full-service cyber-criminal store in a “Virus Depot” fashion. Join us in our upcoming webinar as we discuss how to best defend against these attacks!

kllarsonAuthor Commented:
Forgot the extra click on "Upload File"
Scan-Folder-for-Changed_Added-Files.txt
Bill PrewIT / Software Engineering ConsultantCommented:
I did a test here and your code seemed to work fine, sent an email which I received.

Have you tried running it from a command prompt, to see if any error messages are displayed?

Do you have any virus or malware protection on the computer running the script, perhaps it is blocking outgoing anonymous SMTP email?

~bp
footechCommented:
You could just run a Send-MailMessage command at your console to verify that you're able to send email that way.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kllarsonAuthor Commented:
Thanks for the Send-MailMessage tip. I was able to try that and get a test message through. Doing some more testing, but appears to be working now.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.