55 lines
2.2 KiB
PowerShell
55 lines
2.2 KiB
PowerShell
workflow MissingTransactions {
|
|
|
|
|
|
foreach -parallel ($servernum in 1..10) {
|
|
|
|
|
|
|
|
|
|
$dates = Get-Item -Path "D:\IFSBOData\FSV\Outgoing_notprocessed_files\*"
|
|
|
|
foreach -parallel -throttlelimit 10 ($date in $dates) {
|
|
try {
|
|
$files = Get-ChildItem -Recurse "D:\IFSBOData\FSV\Outgoing_notprocessed_files\$($date.Name)\rejk-p-mdl003v\dcp_ud" | Where-Object -FilterScript { $_.Attributes -cnotcontains 'directory' }
|
|
|
|
Write-Verbose "$computername - csv import"
|
|
$csv = Import-Csv "D:\IFSBOData\FSV\outgoing_histo\$($date.Name)\fsv_histooutgoing.txt" -Header ('box name ; file name ; date of arrival ; number of retries ; date of last send info ; date of ack ; row of sending ; current date' -split ' ; ') -Delimiter ';'
|
|
|
|
$dateFormatted = [datetime]::ParseExact($date.Name,'yyyyMMdd', [cultureinfo]::InvariantCulture)
|
|
|
|
|
|
$filecount = 0
|
|
foreach($file in $files) {
|
|
try {
|
|
$filecount++
|
|
|
|
$filename = $file.Name
|
|
|
|
Write-Verbose "$computername - file filter"
|
|
$result = $csv | Where-Object -FilterScript { $_.'file name' -match $filename }
|
|
if($result.'date of ack' -ne $null) {
|
|
Write-Verbose "$computername - returning obj"
|
|
$foundInSql = 0
|
|
[pscustomobject]@{
|
|
Filename = $filename
|
|
DateOfAck = $($result.'date of ack')
|
|
FoundInSQL = $foundInSql
|
|
Server = $servername
|
|
Date = $date.Name
|
|
}
|
|
}
|
|
|
|
}
|
|
catch {
|
|
Write-Warning "File $($file.Name) failed: $_"
|
|
}
|
|
}
|
|
}
|
|
catch {
|
|
Write-Warning "Date $($date.Name) failed: $_"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$result = MissingTransactions |