User Tools

Site Tools


powershell:nps:findachived

List Archived Certificates

$store = New-Object  System.Security.Cryptography.X509Certificates.X509Store "My","LocalMachine"
 
$MaxAllowedIncludeArchive = ([System.Security.Cryptography.X509Certificates.openflags]::MaxAllowed –bor [System.Security.Cryptography.X509Certificates.openflags]::IncludeArchived)
 
$store.Open($MaxAllowedIncludeArchive)
 
[System.Security.Cryptography.X509Certificates.X509Certificate2Collection] $certificates = $store.certificates
foreach ($cert in $certificates)
{
    if ($cert.Archived)
    {
        Write-Host $cert.SubjectName.Name 
        Write-Host " $($cert.Archived)"
        Write-Host " $($cert.NotAfter)"
    }
}
$store.Close()
powershell/nps/findachived.txt · Last modified: 2018/11/30 00:58 by admin