New-SelfSignedCertificate

I am trying to create a self signed certificate using powershell 3.0 on windows 8 and I keep getting the message:

New-SelfSignedCertificate : E:\Profile\My Documents\WindowsPowerShell
At line:1 char:1

  • New-SelfSignedCertificate
  •   + CategoryInfo          : NotSpecified: (:) [New-SelfSignedCertificate], InvalidStorePathException
      + FullyQualifiedErrorId : RuntimeException,Microsoft.CertificateServices.Commands.NewSelfSignedCertificateCommand
    
    

I can’t find anything on google for InvalidStorePathException

According to the documentation on this cmdlet, the “current path” is the default value for the CertStoreLocation parameter. I’m not sure if that means the CurrentLocation on the Cert: drive, or just your current location in general (regardless of which provider owns your current drive.)

Either way, it’s probably best to just pass this value explicitly. For example, to add the certificate to your personal store:

New-SelfSignedCertificate -DnsName www.fabrikam.com, www.contoso.com -CertStoreLocation cert:\CurrentUser\My