Get-RemoteLdapCertDetails.ps1
19 Sep 2025Description
Purpose
No synopsis provided.
Detailed Description
No detailed description provided.
Usage
No usage examples provided.
Notes
No additional notes.
Script
function Get-RemoteLdapCertDetails {
param (
[Parameter(Mandatory = $true)]
[string]$ComputerName,
[Parameter(Mandatory = $true)]
[pscredential]$Credential
)
$scriptBlock = {
# Get all certificates from the LocalMachine\My store
$certs = Get-ChildItem -Path Cert:\LocalMachine\My
$certDetailsList = @()
foreach ($cert in $certs) {
# Check if the certificate has the Server Authentication EKU
$eku = $cert.EnhancedKeyUsageList | Where-Object { $_.FriendlyName -eq "Server Authentication" }
if ($eku) {
$certDetails = [PSCustomObject]@{
Subject = $cert.Subject
Issuer = $cert.Issuer
Thumbprint = $cert.Thumbprint
NotBefore = $cert.NotBefore
NotAfter = $cert.NotAfter
HasServerAuthEKU = $true
}
$certDetailsList += $certDetails
}
}
return $certDetailsList
}
$certDetailsList = Invoke-Command -ComputerName $ComputerName -ScriptBlock $scriptBlock -Credential $Credential
return $certDetailsList
}
# Example usage
# $computerName = "RemoteServerFQDN"
# $credential = Get-Credential
# $certDetailsList = Get-RemoteLdapCertDetails -ComputerName $computerName -Credential $credential
# Display the retrieved certificate details
# $certDetailsList | Format-List
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.