Forum Discussion
Stover
Jun 03, 2025Copper Contributor
Differences with X509Certificate2 between Powershell and PWSH Core (Windows)
Hi all, I wrote some code that loads a certificate from a crt file and it works so far. But with PWSH (7.5.1) some properties (like DnsNameList) are empty. With Windows Powershell the properti...
Andres-Bohren
Jun 15, 2025Iron Contributor
Hi Stover
Can you check this Code
$Cert = Get-ChildItem Cert:\LocalMachine\My\ | where {$_.Thumbprint -eq "99A90D03DDAC94080B2B94B4262A850B41C8F030"}
$Cert | select subject,NotBefore, notafter, Issuer, Thumbprint,HasPrivateKey, @{name='Subject Alternative Name';expression={($_.Extensions | Where-Object {$_.Oid.FriendlyName -eq "Subject Alternative Name"}).format($true)}}
Kind Regards
Andres
- Andres-BohrenJul 02, 2025Iron Contributor
Stover
Did you test it? Any Feedback?