I am trying to create a powershell script which is based on csv file for metadata, I have defined a column Frequency
with a number in it.
for example :
PageName FrequencyMonths Email Page1 3 security@company.com Page2 6 HR@company.com
I want to know a way that my powershell runs the code whenever the next frequency date is.
The script I have takes input from csv with above like information and runs aa scheduled task "Daily" to send emails to above people at the.
I want to schedule my PS script to run daily however send email only after 3 months to the security team (every after 3 months) and every 6 months to the HR team
Please suggest
Expected result is to send mails to respective teams based on the frequency of months - using a daily running windows scheduled task
Your current script sets $EmailDate
to today + x Month. But everytime the script is run and without saving the value anywhere... You should create another column with the date of the next execution.
If( (get-date).date -le $row.NewColumn ){
# sent the mail
# replace $row.NewColumn with (get-date).Date.AddMonths($Frequency)
}
when you are done export the csv to replace the old one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.