Posts

Showing posts from July, 2020

Powershell - Get certificate information

List Certificate Templates function get-CertificateTemplates { [CmdletBinding()] Param ( [Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$forest ) $DefaultPartition = Get-ADDomainController -Server $forest | select -expand DefaultPartition $configcontext = "CN=Configuration,$($DefaultPartition)" $ADSI = [ADSI]"LDAP://CN=Certificate Templates,CN=Public Key Services,CN=Services,$ConfigContext" $ADSI.Children | Sort-Object Name | Select-Object DisplayName, Name, msPKI-Cert-Template-OID } List Certificate CDP info function get-CertificateCDP { [CmdletBinding()] Param ( [Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$forest ) $DefaultPartition = Get-ADDomainController -Server $forest | select -expand DefaultPartition $configcontext = "CN=Configuration,$($DefaultPartition)" $ADSI = [ADSI]"LDAP://CN=cdp,CN=Public Key Services,CN=Services,$ConfigContext&quo…