diff --git a/Invoke-OpenSSHConfiguration.ps1 b/Invoke-OpenSSHConfiguration.ps1 index 2301735..ddfa390 100644 --- a/Invoke-OpenSSHConfiguration.ps1 +++ b/Invoke-OpenSSHConfiguration.ps1 @@ -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)) diff --git a/Toolkit/Functions/Start-ProcessWithOutput.ps1 b/Toolkit/Functions/Start-ProcessWithOutput.ps1 index d27e275..ad66b5f 100644 --- a/Toolkit/Functions/Start-ProcessWithOutput.ps1 +++ b/Toolkit/Functions/Start-ProcessWithOutput.ps1 @@ -611,7 +611,8 @@ Function Start-ProcessWithOutput $ProcessExecutionTimespan = New-TimeSpan -Start ($Process.StartTime) -End ($Process.ExitTime) - $OutputObjectProperties.ProcessObject = $Process | Select-Object -Property @('*') -ExcludeProperty @('ExitCode', 'StandardInput', 'StandardOutput', 'StandardError', 'SafeHandle', 'Threads', 'StartInfo') + #Suppress verbose output from Select-Object on Process object (can trigger WMI queries) + $OutputObjectProperties.ProcessObject = $Process | Select-Object -Property @('Id', 'ProcessName', 'Path', 'StartTime', 'ExitTime', 'HasExited', 'PriorityClass') -Verbose:$False -ErrorAction SilentlyContinue $WriteLogMessage.Invoke(0, @("Process Exit Time: $($Process.ExitTime.ToString($DateTimeLogFormat))")) diff --git a/Toolkit/Toolkit.ps1 b/Toolkit/Toolkit.ps1 index 731866f..0c8f905 100644 --- a/Toolkit/Toolkit.ps1 +++ b/Toolkit/Toolkit.ps1 @@ -308,11 +308,11 @@ Try #endregion #region Load WMI Classes - $Baseboard = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_Baseboard" -Property * - $Bios = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_Bios" -Property * - $ComputerSystem = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_ComputerSystem" -Property * - $MSSystemInformation = Get-CIMInstance -Namespace "root\WMI" -ClassName "MS_SystemInformation" -Property * - $OperatingSystem = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_OperatingSystem" -Property * + $Baseboard = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_Baseboard" -Property * -Verbose:$False + $Bios = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_Bios" -Property * -Verbose:$False + $ComputerSystem = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_ComputerSystem" -Property * -Verbose:$False + $MSSystemInformation = Get-CIMInstance -Namespace "root\WMI" -ClassName "MS_SystemInformation" -Property * -Verbose:$False + $OperatingSystem = Get-CIMInstance -Namespace "root\CIMv2" -ClassName "Win32_OperatingSystem" -Property * -Verbose:$False #endregion #region Define Variables