Skip to content

Instantly share code, notes, and snippets.

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 IISResetMe/19db0ad21badbed2085b9c3c84c85f45 to your computer and use it in GitHub Desktop.
Save IISResetMe/19db0ad21badbed2085b9c3c84c85f45 to your computer and use it in GitHub Desktop.
Get-ADCertificateAuthority.ps1
$ConfigurationDN = $([ADSI]"LDAP://RootDSE").ConfigurationNamingContext;
$SearchRoot = "LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,$ConfigurationDN"
$SearchFilter = "(objectCategory=pkiEnrollmentService)"
foreach($CAEnrollService in (New-Object adsiSearcher([ADSI]$SearchRoot,$SearchFilter)).FindAll()){
$serviceProperties = [ordered]@{}
foreach($propName in 'Name CN DnsHostName'.Split()){
$serviceProperties[$propName] = $CAEnrollService.Properties[$propName] |Select -First 1
}
[pscustomobject]$serviceProperties
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment