fix(scripts): satisfy PSScriptAnalyzer (lint gate)

- Remove-Securely: suppress PSUseShouldProcessForStateChangingFunctions
  (internal best-effort shred; ShouldProcess prompts are undesirable)
  + add [CmdletBinding()].
- Replace the two empty catch blocks (Set-CIGuestCredential.ps1,
  Test-CIGuestWinRM.ps1) with Write-Verbose so PSAvoidUsingEmptyCatchBlock
  is satisfied while keeping best-effort behavior.
This commit is contained in:
Simone
2026-05-17 22:31:34 +02:00
parent b6d8a51101
commit 057bfcf63a
2 changed files with 11 additions and 2 deletions
+3 -1
View File
@@ -116,7 +116,9 @@ try {
$cn = $ssl.RemoteCertificate.Subject # e.g. "CN=WINBUILD"
if ($cn -match 'CN=([^,]+)') { $guestCn = $Matches[1].Trim() }
$ssl.Dispose(); $tcpc.Close()
} catch { }
} catch {
Write-Verbose "cert CN probe failed (hostname auto-detect skipped): $_"
}
if ($guestCn) {
Write-Host " guest cert CN (hostname): $guestCn" -ForegroundColor Cyan
}