34,333
edits
Changes
→Protecting Certificates with Private Key Encryption
Right click on the selected certificate and select "All Tasks -> Export..." from the context menu to invoke the Certificate Export Wizard. Click ''Next'' on the Welcome screen to proceed to the ''Export Private Key'' page and select the ''Yes, export private key'' option. Click ''Next'' to proceed to the Export File Format screen and select the ''Personal Exchange Format'' option.
On the next screen, enter the password to be used to protect the key and click ''Next''. Finally, specify a filename and location for the .pfx file (for the purposes of this example we will use the name ''cert.pfx''). Click ''Next'' to display the summary screen. Review the summary information and click ''Finish'' to export the key.
The resulting pfx file will subsequently be used access the certificate using the ''Get-PfxCertificate'' cmdlet as illustrated below. Before PowerShell will permit the script to be signed, however, the password entered during the export process must be entered:
<pre>
</pre>
Once extracted, the certificate may be used to sign scripts using the usual script signing commandsyntax:
<pre>