PowerShell script to create Dates.csv file

PowerShell script "CreateDatesFile.ps1" will create file "Dates.csv". More information about requirements for Dates.csv file can be found in "Dates.csv file documentation". This script is included in data_scripts.zip

Script to create "Dates.csv" file is very simple. We get MinDate from configuration parameter and then get MaxDate from the todays date. Then we create file with first row as a header "Date" and then list of all dates between MinDate and MaxDate. Core PowerShell code to do this is :

$outFile = $psDataFolder + "\Dates.csv"; $strD = "Date"; $dToday = Get-Date;
$dDate = [datetime]::ParseExact($minDate,”yyyy-MM-dd”,$null);
while ($dDate -le $dToday) {
   $strD += "`r`n" + $dDate.ToString("yyyy-MM-dd") ;
   $dDate = $dDate.AddDays(1);
};
$strD | Out-File $outFile -Encoding OEM;
Actual script to generate Dates.csv file is bigger because it includes code to read configuration file and output log information on the screen and into the log file.