Forum Discussion
Hello,
Working on the Active Directory script to get the "Issuer" listed on the display, alert, widget, report...
Quote$readOnly = [System.Security.Cryptography.X509Certificates.OpenFlags]"ReadOnly"
$localMachine = [System.Security.Cryptography.X509Certificates.StoreLocation]"LocalMachine"
$store = new-object System.Security.Cryptography.X509Certificates.X509Store( "\\##SYSTEM.SYSNAME##\my", $localMachine )
$properties = @(
@{n='IssuedBy';e={(($_.Issuer -split ",") |? {$_ -like "CN=*"}) -replace "CN="}}
)$store.Open( $readOnly )
$store.Certificates `
| Select-Object { `
$_.Thumbprint + "##" `
+ $(If ($_.FriendlyName -eq "") {"Unknown friendly name (" + $_.Thumbprint + ")"} Else {$_.FriendlyName}) + "##" `
+ $_.Subject + $(If ($_.Subject -ne "") {"(..." + $_.Thumbprint.SubString($_.Thumbprint.length - 5, 5) + ")"} Else {"Unknown subject (" + $_.Thumbprint + ")"}) + "##" `
+ "##" `
+ "cert.issuer=" + $_.Issuer `
+ "&cert.IssuedBy" + $_.IssuedBy `
+ "&cert.friendlyname=" + $_.FriendlyName `
+ "&cert.serialnumber=" + $_.SerialNumber `
+ "&cert.thumbprint=" + $_.Thumbprint `
} `
| Format-Table -HideTableHeaders
Thanks,
Dom
Related Content
- 6 months ago