Skip to content

Instantly share code, notes, and snippets.

@norman-bauer
Last active January 10, 2022 08:47
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 norman-bauer/323d5573d8156a61a45d9d7a3a30f07e to your computer and use it in GitHub Desktop.
Save norman-bauer/323d5573d8156a61a45d9d7a3a30f07e to your computer and use it in GitHub Desktop.
PowerShell script to unarchive a previously archived certificate in the local machine my store
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store "My","LocalMachine"
$store.Open(9) #ReadWrite + IncludeArchived
$store.Certificates |? Archived -eq $true
$store.Certificates |? Archived -eq $true |% {$_.Archived = $false} #Unarchive all certificates
$store.Certificates |? Subject -eq "CN=archivedcert" |% {$_.Archived = $false} #Unarchive certificates with given subject
$store.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment