mirror of
https://github.com/Grace-Solutions/Invoke-OpenSSHConfiguration.git
synced 2026-07-26 11:38:14 +00:00
Suppress CIM verbose, add CurrentUser CA stores, dedupe certificates
- Suppress Get-CIMInstance verbose output in Toolkit.ps1 with -Verbose:$False - Add CurrentUser Root and CA stores alongside LocalMachine stores - Dedupe certificates by Thumbprint (Sort-Object -Unique) - Suppress verbose from Process Select-Object (triggers WMI queries) - Use explicit property list instead of wildcard for process object
This commit is contained in:
@@ -477,11 +477,14 @@ Switch (Test-ProcessElevationStatus)
|
||||
|
||||
$CertificateExpirationThreshold = Get-Date
|
||||
|
||||
#Include both LocalMachine and CurrentUser CA stores
|
||||
$CertificateStorePathList = New-Object -TypeName 'System.Collections.Generic.List[System.String]'
|
||||
$CertificateStorePathList.Add('Cert:\LocalMachine\Root')
|
||||
$CertificateStorePathList.Add('Cert:\LocalMachine\CA')
|
||||
$CertificateStorePathList.Add('Cert:\CurrentUser\Root')
|
||||
$CertificateStorePathList.Add('Cert:\CurrentUser\CA')
|
||||
|
||||
$CACertificates = Get-ChildItem -Path $CertificateStorePathList | Where-Object {($_.NotAfter -gt $CertificateExpirationThreshold) -and ($_.Extensions | Where-Object {($_.Oid.FriendlyName -iin @('Basic Constraints')) -and ($_.CertificateAuthority -eq $True)})}
|
||||
$CACertificates = Get-ChildItem -Path $CertificateStorePathList -ErrorAction SilentlyContinue | Where-Object {($_.NotAfter -gt $CertificateExpirationThreshold) -and ($_.Extensions | Where-Object {($_.Oid.FriendlyName -iin @('Basic Constraints')) -and ($_.CertificateAuthority -eq $True)})} | Sort-Object -Property @('Thumbprint') -Unique
|
||||
|
||||
#region Apply CA Inclusion Filter
|
||||
Switch (([System.String]::IsNullOrEmpty($CAInclusionExpression) -eq $False) -and ([System.String]::IsNullOrWhiteSpace($CAInclusionExpression) -eq $False))
|
||||
|
||||
Reference in New Issue
Block a user