title: X509Enrollment.CX509PrivateKey Create without Admin rights
body: <p>I'm writing a Powershell script that creates self signed certificates which works fine as an Administrator but fails as Admin:</p>
  
  <p>The piece of code that fails when I call the Create method:</p>
  
  <pre><code>$PrivateKey = New-Object -ComObject X509Enrollment.CX509PrivateKey
  $PrivateKey.ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
  $PrivateKey.KeySpec = 0x1
  $PrivateKey.Length = 2048
  
  # set security descriptor
  $PrivateKey.SecurityDescriptor = "D:PAI(A;;0xd01f01ff;;;SY)(A;;0xd01f01ff;;;BA)(A;;0x80120089;;;NS)"
  
  # key will be stored in local machine certificate store
  $PrivateKey.MachineContext = 0x1
  
  # export will be allowed
  $PrivateKey.ExportPolicy = 0x1
  $PrivateKey.Create()
  </code></pre>
  
  <p>It throws this error:</p>
  
  <pre><code>Exception calling "Create" with "0" argument(s): "CertEnroll::CX509PrivateKey::Create: Access is denied. 0x80070005
  (WIN32: 5)"
  At C:\dev\LinoaSSC.ps1:106 char:1
  + $PrivateKey.Create()
  + ~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  + FullyQualifiedErrorId : ComMethodTargetInvocation
  </code></pre>
  
  <p>How should I troubleshoot or solve this error? Thanks guys!</p>