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#-