0 votes

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!

by (130 points)

1 Answer

0 votes
by (130 points)

I figured this out. I just set the task to run "Always," and updated the script itself to run the import if Test-Path returns true for the file.

Related questions

0 votes
1 answer

and script is but nothing is happeneing. my user in adaxe browwser has the attribute to yes

asked May 10, 2023 by fjacques (20 points)
0 votes
1 answer

Hello, Based on your script, we check whether there is already a request. However, we often get the following error and do not know why. Can you help us? ... Cannot compare "Softerra.Adaxes.Adsi.Search.AdmSearchResult" because it is not IComparable. Thank you

asked Apr 16 by DRiVSSi (300 points)
0 votes
1 answer

Hello, I need to check, from a csv file, if users exist or not. I do not have the login name but only the atributs Name givenName The output must be another csv file ... " --> False or True Is there an Adaxes script existing doing this? Thanks in advance!

asked Feb 4, 2019 by tentaal (1.1k points)
0 votes
1 answer

Hallo everyone, I'm new to this Forum and I hope that someone can help me. My Environment: - Adaxes Backend Service and Web Frontend running on different mashines. - The backend ... I change the scope of objects :?: Question: Can someone help me? Thanks a lot.

asked Apr 28, 2015 by ATiedemann (360 points)
0 votes
1 answer

In our organization, we have two domains. Is there a way to create a rule to check the other domain if the account exists before creating the account?

asked Mar 28, 2013 by Kikaida (1.1k points)
3,547 questions
3,238 answers
8,232 comments
547,809 users