Forum Discussion
8 hours ago, Stuart Weenig said:Your problem is this line. It's resolving to only be "[Subject]...". I would re-evaluate your If statement. It looks like it's resolving to a null value. You might consider commenting out the if statement to see if you can just put the $_.Issuer in there.
Let me try to get the $_.Issuer only...
Quote##--------------- Discovery ------------------##
$pshost = Get-Host # Get the PowerShell Host.
$pswindow = $pshost.UI.RawUI # Get the PowerShell Host's UI.$newsize = $pswindow.BufferSize # Get the UI's current Buffer Size.
$newsize.width = 800 # Set the new buffer's width to 800 columns.
$pswindow.buffersize = $newsize # Set the new Buffer Size as active.$newsize = $pswindow.windowsize # Get the UI's current Window Size.
$newsize.width = 800 # Set the new Window Width to 800 columns.
$pswindow.windowsize = $newsize # Set the new Window Size as active.$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 + "##" `
+ "$_.Issuer" + "##" `
+ $_.Subject + "$_.Issuer" + "##" `
## + $(If ($_.FriendlyName -eq "") {"Unknown friendly name (" + $_.Thumbprint + ")"} Else {$_.FriendlyName}) + "##" + "$_.Issuer" + "##" ` ##
## + $_.Subject + $(If ($_.Subject -ne "") {"(..." + $_.Thumbprint.SubString($_.Thumbprint.length - 5, 5) + ")"} Else {"Unknown subject (" + $_.Thumbprint + ")"}) + "$_.Issuer" + "##" ` ##
+ "##" `
+ "cert.issuer=" + $_.Issuer `
+ "&cert.friendlyname=" + $_.FriendlyName `
+ "&cert.serialnumber=" + $_.SerialNumber `
+ "&cert.thumbprint=" + $_.Thumbprint `
} `
| Format-Table -HideTableHeaders
but I am back to the message "there would be no instance discovered for the selected device"...
I tries with quotes, double-quotes, no quote same result.
Thanks,
Dom
Related Content
- 6 months ago