Skip to content

Instantly share code, notes, and snippets.

@MudraR
Created November 3, 2025 16:06
Show Gist options
  • Select an option

  • Save MudraR/0797bfd658fb00824e428e7bab61b084 to your computer and use it in GitHub Desktop.

Select an option

Save MudraR/0797bfd658fb00824e428e7bab61b084 to your computer and use it in GitHub Desktop.
Analyze Certificates throwing "Parameter is incorrect" error during install
$thumbprintList = @(
'CERTIFICATETHUMBPRINT',
'CERTIFICATETHUMBPRINT2'
)
$report = foreach ($thumbprint in $thumbprintList) {
$cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Thumbprint -eq $thumbprint }
if ($cert) {
$key = [Security.Cryptography.X509Certificates.RSACertificateExtensions]::GetRSAPrivateKey($cert)
$file = Get-ChildItem -Path 'C:\ProgramData\Application Data\Microsoft\Crypto' -Recurse -Filter $key.key.UniqueName
[pscustomobject]@{
Thumbprint = $thumbprint
CN = $cert.Subject
Provider = $key.key.Provider
Name = $key.key.UniqueName
File = $file.Directory
}
}
}
$report
@MudraR
Copy link
Author

MudraR commented Nov 3, 2025

Potential issue: Private key is getting installed in a directory that is not expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment