Created
November 3, 2025 16:06
-
-
Save MudraR/0797bfd658fb00824e428e7bab61b084 to your computer and use it in GitHub Desktop.
Analyze Certificates throwing "Parameter is incorrect" error during install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Potential issue: Private key is getting installed in a directory that is not expected?