Forum Discussion
1 hour ago, Stuart Weenig said:You wouldn't literally put instance3_id##instance3_name##instance3_description. And you wouldn't try to set it as a property called system.systemDescription. You need to put the issuer name between the "##" at the end of line 42 and before the "##" at the end of line 43.
When your active discovery script outputs to sdtout, you need to put it in the format <instance id>##<instance display name>##<instance description>.
It looks like your discovery script is already putting (or attempting to put) something in the description. Line 43 is your current description:
+ $_.Subject + $(If ($_.Subject -ne "") {"(..." + $_.Thumbprint.SubString($_.Thumbprint.length - 5, 5) + ")"} Else {"Unknown subject (" + $_.Thumbprint + ")"}) + "##" `You would need to decide if you want to replace this description (which appears to come from the Subject, or if the Subject is missing, the thumbprint) with the issuer ($_.Issuer).
Hello,
Still the same message with these two updates I tried using "$_.Issuer" (the original field) but also "IssuedBy" the real field I need after cleanup ...
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 )##--------------- 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="}}
@{n='Decription' ; e={instance3_id##instance3_name##instance3_description)}
)$store.Open( $readOnly )
$store.Certificates `
| Select-Object { `
$_.Thumbprint + "##" `
+ $(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 `
+ "&system.systemDescription=" + $_.instance3_id##instance3_name##instance3_description `
} `
| Format-Table -HideTableHeaders
Also I added "IssuedBY" or "$_.Issuer"as I need the informationb as well..
I will also remove the 16 first lines as they look duplicated by 17-32 !!!
Thanks,
Dom
Related Content
- 6 months ago