How to find all Certificate Authorities (CA) in your domain?

Last post 08-06-2008 10:01 AM by r.heinkens. 1 replies.

Sort Posts:

  • How to find all Certificate Authorities (CA) in your domain?

    08-06-2008, 5:55 AM
    • Member
      429 point Member
    • r.heinkens
    • Member since 04-29-2008, 1:26 PM
    • Groningen
    • Posts 120

    Hi,

    I want to perform a check on the certificate authorities in my domain using ASP.NET and C#. I want to list all certificate authorities and validatie that they are alive. Does anyone know how to list all CA's? Below is a PowerShell equivalent using CertUtil. $Result contains all the lines resulting from the dump from CertUtil.

    $Result = (Invoke-Expression "$Env:SystemRoot\System32\certutil.exe")

    Cheers,

    Rodney
    IT Consultant
  • Re: How to find all Certificate Authorities (CA) in your domain?

    08-06-2008, 10:01 AM
    Answer
    • Member
      429 point Member
    • r.heinkens
    • Member since 04-29-2008, 1:26 PM
    • Groningen
    • Posts 120

    I found a nice namespace in the .NET Framework, see the code below. I added the original PowerShell code also. 

    //$dom = [System.DirectoryServices.ActiveDirectory.Domain]::getcurrentdomain()

    System.DirectoryServices.ActiveDirectory.Domain domain = System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain();

    //Get the DC's for the domain

    //$dom.DomainControllers select Name

    System.DirectoryServices.ActiveDirectory.DomainControllerCollection domainControllerCollection = domain.DomainControllers;

    //Process DC's

    foreach (System.DirectoryServices.ActiveDirectory.DomainController domainController in domainControllerCollection) {

    // Do something with the domain controller

    }

    Cheers,

    Rodney
    IT Consultant
Page 1 of 1 (2 items)