简体   繁体   中英

C# : How can I retrieve the “personal” certificates installed on a remote computer

I want to fetch the expiry dates of all the "Personal" certificates installed on a Remote Computer. I have the computer's HostName. I am trying to retrieve the certificates using the code below:

X509Store store = new X509Store("personal", StoreLocation.LocalMachine);
foreach (X509Certificate2 c in store.Certificates)
{
    DisplayCertificate(c);
}

Try to execute this using powershell in C#-

$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("\$server_name\My","LocalMachine")

$store.Open("ReadOnly")
$store.Certificates

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM