====== Create X.509 certificate via Powershell ====== PS E:\Certificates> new-selfsignedcertificate -certstorelocation cert:\localmachine\my -dnsname www.example.com -NotAfter 2100.12.31 PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\my Thumbprint Subject ---------- ------- 6B56F00AA1EB7C981614072D6BBB89F292D3A0BA CN=www.example.com PS E:\Certificates> $pwd = ConvertTo-SecureString -String "GCgcPIN**1" -Force -AsPlainText PS E:\Certificates> Export-PfxCertificate -cert cert:\localMachine\my\6B56F00AA1EB7C981614072D6BBB89F292D3A0BA -FilePath e:\Certificates\Client.pfx -Password $pwd Directory: E:\Certificates Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 09/27/2017 10:54 2725 Client.pfx PS E:\Certificates>