Scanning certificates store does not show all certificates
<p>I created a C#.Net console program listed below to scan all Certificate Stores and show Certificate information. The problem is that it is not showing all certificates.  </p>

<p>For example, this command line shows Certificates in the Personal Store:</p>

<pre><code>CERTUTIL.EXE -store My
</code></pre>

<p>However my test program shows it as having no Personal certificates. I am using Windows 2008 R2.  Here is the abbreviated console app. Any idea what I might be doing wrong? I tried both in a regular CMD Window, and As Administrator with the same results.</p>

<pre><code>using System;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Collections;

namespace CertView
{
    class Program
    {
        static int Main(string[] args)
        {
            var stores = Enum.GetValues(typeof(StoreName));
            IEnumerator enumStores = stores.GetEnumerator();
            foreach (StoreName sn in stores)
            {
                X509Store str = new X509Store(sn.ToString());
                str.Open(OpenFlags.ReadOnly);
                int count = str.Certificates.Count;
                if (count &gt; 0)
                {
                    Console.WriteLine("Store: " + sn.ToString() + Environment.NewLine);
                    foreach (X509Certificate2 x509 in str.Certificates)
                    {
                        Console.WriteLine("Friendly name: {0}", x509.FriendlyName);
                        Console.WriteLine("Issued to: " + x509.GetNameInfo(X509NameType.SimpleName, false));
                        Console.WriteLine("Issued by: " + x509.GetNameInfo(X509NameType.SimpleName, true));
                        Console.WriteLine("Thumbprint: " + x509.Thumbprint);
                        x509.Reset();
                    }
                }
                str.Close();
            }
        }
    }
}
</code></pre>