diff --git a/Extractor.ps1 b/Extractor.ps1 index f16044a..719ee3a 100644 --- a/Extractor.ps1 +++ b/Extractor.ps1 @@ -140,11 +140,19 @@ function buildIntervals { function PrintAffected { param ( $listOfIntervals, - [datetime]$point + [datetime]$point, + [switch] $verbose ) + $array = @() foreach ($elem in $listOfIntervals){ if ($point -le $elem.ending -and $point -ge $elem.begining){ - Write-Host "$point : $($elem.vm) $($elem.state)" + if ($verbose) { + Write-Host "$point : $($elem.vm) $($elem.state)" + } + if(!$array.Contains($elem.vm)){ + $array += @($elem.vm) + } } } + return $array } \ No newline at end of file diff --git a/tests/extractortest malformed fail.txt b/tests/extractortest malformed fail.txt index 9a78cde..3ce17ca 100644 --- a/tests/extractortest malformed fail.txt +++ b/tests/extractortest malformed fail.txt @@ -12,4 +12,14 @@ snrdaoeisnrdaoie:2024-02-06 20:00:00 some harddrive operation snrdaoeisnrdaoie:2024-02-06 20:00:00 some other Harddrive operation snrdaoeisnrdaoie: VMware-Maschine 'test2' snrdaoeisnrdaoie:aoei aoei VMware-Maschine 'test2' -snrdaoeisnrdaoie:2024-02-06 21:00:00 VMware-Maschine 'test2' \ No newline at end of file +snrdaoeisnrdaoie:2024-02-06 21:00:00 VMware-Maschine 'test2' + +snrdaoeisnrdaoie:2024-02-06 20:00:00 gestartet VMware-Maschine 'test' +snrdaoeisnrdaoie:2024-02-06 20:00:00 gestartet VMware-Maschine 'test' +snrdaoeisnrdaoie:2024-02-06 20:00:00 some harddrive operation +nsriadoeisnrdaoei +snrdaoeisnrdaoie:2024-02-06 20:00:00 some other Harddrive operation +snrdaoeisnrdaoie:2024-02-06 20:01:00 VMware-Maschine 'test' Erfolgreiche +snrdaoeisnrdaoie:2024-02-06 20:01:00 VMware-Maschine 'test' Erfolgreiche +snrdaoeisnrdaoie:2024-02-06 20:01:00 VMware-Maschine 'test' +snrdaoeisnrdaoie:2024-02-06 20:00:00 gestartet VMware-Maschine 'test2' \ No newline at end of file