Skip to content

Instantly share code, notes, and snippets.

@kvaps
Created April 8, 2016 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvaps/1e5888de86b995edef0a28ddd919db4e to your computer and use it in GitHub Desktop.
Save kvaps/1e5888de86b995edef0a28ddd919db4e to your computer and use it in GitHub Desktop.
# Password for Encription Certificate
$secret = "MyPassw0rd"
Get-ChildItem cert:\currentuser\my | Out-String -Width 512 | Out-File "$Env:USERPROFILE\Documents\info.txt"
# Copying Certificate to My Document
Get-ChildItem cert:\currentuser\my |
# Where-Object { $_.HasPrivateKey -and $_.PrivateKey.CspKeyContainerInfo.Exportable } |
Foreach-Object { [system.IO.file]::WriteAllBytes( "$Env:USERPROFILE\Documents\$($_.thumbprint).pfx" , ($_.Export('PFX', $secret )) ) }
## End of the script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment