PrintAffected to GetAffected, will now only print to screen in switch verbose is given

This commit is contained in:
Karl-Wilfried Zimmer 2024-02-09 00:06:14 +01:00
parent 545d790a8b
commit 49a6f65a76
2 changed files with 21 additions and 3 deletions

View File

@ -140,11 +140,19 @@ function buildIntervals {
function PrintAffected { function PrintAffected {
param ( param (
$listOfIntervals, $listOfIntervals,
[datetime]$point [datetime]$point,
[switch] $verbose
) )
$array = @()
foreach ($elem in $listOfIntervals){ foreach ($elem in $listOfIntervals){
if ($point -le $elem.ending -and $point -ge $elem.begining){ 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
} }

View File

@ -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:2024-02-06 20:00:00 some other Harddrive operation
snrdaoeisnrdaoie: VMware-Maschine 'test2' snrdaoeisnrdaoie: VMware-Maschine 'test2'
snrdaoeisnrdaoie:aoei aoei VMware-Maschine 'test2' snrdaoeisnrdaoie:aoei aoei VMware-Maschine 'test2'
snrdaoeisnrdaoie:2024-02-06 21:00:00 VMware-Maschine 'test2' 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'