Skip to content

Instantly share code, notes, and snippets.

@awakecoding
Last active August 18, 2023 19:04
Show Gist options
  • Save awakecoding/cbd1c3b82ab76653b9858a2788a7c895 to your computer and use it in GitHub Desktop.
Save awakecoding/cbd1c3b82ab76653b9858a2788a7c895 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)"
$EnrollmentServices = @()
(New-Object adsiSearcher([ADSI]$SearchRoot,$SearchFilter)).FindAll() | ForEach-Object {
$EnrollmentServices += [PSCustomObject] [hashtable] $_.Properties
}
@awakecoding
Copy link
Author

@albert-widjaja do you have more than one CAs? I wonder if that's the main difference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment