Last active
January 23, 2018 19:13
-
-
Save magnuswatn/69545b446abdf6b939bd8e318bb088bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Quick script to dump all the issued certs from a Active Directory Certificates Services server | |
Magnus Watn <[email protected]> | |
#> | |
$allCerts = certutil -view -out rawCertificate | |
$counter = 0 | |
For ($i=0; $i -le $allCerts.length; $i++) { | |
if ($allCerts[$i] -eq '-----BEGIN CERTIFICATE-----') { | |
$cert = "" | |
while ($allCerts[$i] -ne '-----END CERTIFICATE-----') { | |
$cert += "$($allCerts[$i])`r`n" | |
$i++ | |
} | |
$cert += "$($allCerts[$i])`r`n" | |
$cert | Out-File -Encoding Ascii "$($counter).cer" | |
$counter++ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment