I have a created a powershell script that imports users in to Active Directory, creates a result file, archives the CSV and the result file, and e-mails specified users when with the files attached. It's kind of messy, but it works really well. I then added this script to scheduled task which kicks off every hour, which also works well.
The only problem is, regardless of whether there's a CSV file present to import from, the script e-mails the users every hour, even though nothing gets imported every hour. I was wondering if there was a way to kick the script off only if that CSV file was present? I noticed there is an option for "If Powershell Script Returns True," and I'm sure there is a way to accomplish what I'm asking for using that, but I'm very new to Powershell and I have no idea where to begin.
Thanks!