From a3a24199b307a7c4cf3a4c504fb8b0d28ac9ac0c Mon Sep 17 00:00:00 2001 From: Simone Date: Sun, 10 May 2026 22:50:12 +0200 Subject: [PATCH] fix: resolve PSScriptAnalyzer ParseError and StrictMode Count issue --- scripts/Cleanup-OrphanedBuildVMs.ps1 | 4 ++-- scripts/Invoke-RetentionPolicy.ps1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Cleanup-OrphanedBuildVMs.ps1 b/scripts/Cleanup-OrphanedBuildVMs.ps1 index e83edfa..262c18b 100644 --- a/scripts/Cleanup-OrphanedBuildVMs.ps1 +++ b/scripts/Cleanup-OrphanedBuildVMs.ps1 @@ -57,8 +57,8 @@ if (-not (Test-Path $VmrunPath -PathType Leaf)) { } $cutoff = (Get-Date).AddHours(-$MaxAgeHours) -$orphans = Get-ChildItem -Path $CloneBaseDir -Directory -ErrorAction SilentlyContinue | - Where-Object { $_.LastWriteTime -lt $cutoff } +$orphans = @(Get-ChildItem -Path $CloneBaseDir -Directory -ErrorAction SilentlyContinue | + Where-Object { $_.LastWriteTime -lt $cutoff }) if (-not $orphans) { Write-Host "[Cleanup] No orphaned VMs found (threshold: $MaxAgeHours h)." diff --git a/scripts/Invoke-RetentionPolicy.ps1 b/scripts/Invoke-RetentionPolicy.ps1 index 51dc433..0213deb 100644 --- a/scripts/Invoke-RetentionPolicy.ps1 +++ b/scripts/Invoke-RetentionPolicy.ps1 @@ -90,7 +90,7 @@ function Remove-OldJobDirs { Where-Object { $_.LastWriteTime -lt $cutoff } if (-not @($old).Count) { - Write-Host "[RetentionPolicy] $Label: nothing to purge (cutoff: $($cutoff.ToString('yyyy-MM-dd')))." + Write-Host "[RetentionPolicy] ${Label}: nothing to purge (cutoff: $($cutoff.ToString('yyyy-MM-dd')))." return }