Ever needed to enumerate certificates installed on a remote machine using just C# and .NET without having to use an agent? It was a problem I’ve had a couple of times now and was able to figure out without the help of MSDN or StackOverflow. I discovered the X509Store class has the power to solve this problem for us as it utilizes the C++ CertOpenStore functionality underneath, but it’s not documented anywhere. As a result, you can use some of the same functionality as the underlying library at the C# level, just by simply doing this…[gist https://gist.github.com/wholroyd/b7026197c485c6085c60]
It’s evidently the second time I’ve had to do this type of lookup. Luckily I remembered to post the answer back to my own StackOverflow question years ago.