Frequency of script - powershell

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

Related

Google Sheets - Protect monthly range script needs monthly triggers at specified date and time

I would like to request help with a script Im trying to put together.
Linked is my test spreadsheet including the script I currently have on the second sheet.
The idea is that this sheet will be copied individually to a group of people. Each person will get their own sheet, editable only by them and myself. It does not get shared any further. Each day the person will add a value into the corresponding day's cell.
On the last day of each month at 8pm, I would like to protect (lock) the cells for that month, to stop the person changing any values that they previously entered.
I have put a repeating script together with a function for each month, covering each range. The problem I'm having is creating triggers that will run the function on the required day. If I set a monthly trigger, they will all trigger at the same time at the end of the first month. Ideally I need individual triggers that will run once a year on the specified date and time for each individual function.
Is this possible? Is there a better way of doing this?
I also realise that I will need to give permissions for each function run, and possibly for each individual copy of the sheet I give to said persons. Is there a clever way around that?
Im also thinking another approach would be for the script to trigger each monthly function 'on open' if the relative date has passed. For example, on Open, if Date is Feb 1st, lock January range, and so on.
Any help provided would be greatly appreciated.
(Note: the true sheet I copied my script and layout from starts this section at Column U, which is why I have minimised Columns A-T).
Test Sheet Link: https://docs.google.com/spreadsheets/d/13z8eWpo6oislkGX3USifLWqh5sz3DsJpSY1YyqNLrx8/edit?usp=sharing

How do i clear all results in powershell

When i first run a script in powershell, the email I’ve received is blank but there is a result displayed in the console. after i rerun it again, the displayed results in the email is from the previous execution. I’ve tried using clear-history and cls but it didnt work.
Example :
I run a script using previous date n current date. The email did not display any values
The second time i run the script using current month, the values in email content n html table is displayed from previous and current date

import CSV file, get monitor serial based csv data

I'm trying to figure out is there a way to read CSV file in Powershell
and import in cell 1 column 1 the data -"machine name" to get the
monitor serial number ?
Right now I have this code in which I manually replace the machine name (Station01) with the monitor serial number and then I copy the serial number and paste it into the csv file.
I'm hoping the that Csv file can be used to record multiple monitors for each serial number on the columns.
Example, 4 or 5 lines one for each machine containing the serial numbers 2 or 3 monitors.
This I want to achieve using a Powershell script -
Get input list of machine name on csventer code here run the report and see the serial number on it
Earlier we were using vb script that used to work.
But it doesn't work for some reason now.
Please help me with such Powershell script?

Crystal Reports Attachement Filename With Yesterdays Date

I've scheduled a report to run in the Crystal Reports CMC and the report creates an excel file and e-mails it to the recipients. I'm currently naming the extension:
%SI_NAME%_%SI_STARTTIME%.%EXT%
But this is a bit misleading. The report runs early in the morning and displays data from yesterday and earlier. The name might imply to some users that it has today's data and earlier. Is it possible to have SI_STARTTIME - 1 or something along those lines to get yesterdays date as the files name?
Thanks!

SSIS Variable with loop

I am trying to download from SOAP API. The supplier has set a limit to download 1000 records per select. I would like to set up "for loop" container to iterate all records in one file.
The Url expect two variables for data i.e Select and Skip. For this I have added two variables #select and #skip and create a web service task and set up the variable with #Select and #Skip.
this webservice task runs ok, but i am stuck on working out a logic to loop through and download all rows in one file.
for the first run the #skip should be 0 for the consecutive run #skip should be previous value of #skip+1000.
Can someone please help to achieve this?
Thanks