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?
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.
0
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"
0
Bill PrewCommented:
Did you mean to attach something to the prior post?

~bp
0
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

kllarsonAuthor Commented:
Forgot the extra click on "Upload File"
Scan-Folder-for-Changed_Added-Files.txt
0
Bill PrewCommented:
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
0
footechCommented:
You could just run a Send-MailMessage command at your console to verify that you're able to send email that way.
0

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.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.