ci(lint): enhance PSScriptAnalyzer settings and suppress false positives; improve error handling in scripts
This commit is contained in:
@@ -438,7 +438,7 @@ try {
|
||||
-Authentication Basic -ErrorAction Stop
|
||||
Remove-PSSession $probe -ErrorAction SilentlyContinue
|
||||
return $true
|
||||
} catch { }
|
||||
} catch { Write-Verbose "WinRM probe attempt failed." }
|
||||
}
|
||||
return $false
|
||||
}
|
||||
@@ -481,7 +481,7 @@ try {
|
||||
if ($session) {
|
||||
try {
|
||||
Invoke-Command -Session $session -ScriptBlock { Restart-Computer -Force } -ErrorAction SilentlyContinue
|
||||
} catch { }
|
||||
} catch { Write-Verbose "Reboot command sent; session may have already dropped." }
|
||||
Remove-PSSession $session -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ try {
|
||||
try {
|
||||
Invoke-Command -Session $session -ScriptBlock { Restart-Computer -Force } -ErrorAction SilentlyContinue
|
||||
}
|
||||
catch { }
|
||||
catch { Write-Verbose "Reboot command sent; session may have already dropped." }
|
||||
Remove-PSSession $session -ErrorAction SilentlyContinue
|
||||
$session = $null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user