Forum Discussion
2 hours ago, Stuart Weenig said:Adding something to the instance description is pretty easy. Just modify your active discovery script so that the output looks like this:
instance3_id##instance3_name##instance3_description instance4_id##instance4_name##instance4_description instance5_id##instance5_name##instance5_description instance6_id##instance6_name##instance6_description
If you want to alert whenever DaystoExpire is not positive, just set a threshold on that datapoint for < 0.
If you want to list the issuer in the resource tree, adding it as the description would do it. Instance descriptions show up in smaller text under each instance.
If you want it to show up on a dashboard, you might end up needing to make the issuer part of the instance name. Worth trying out other methods before going to that extreme.
For what it's worth, if you specify the issuer as an instance level property, you could automatically group the instances by issuer under the resource tree.
Hello,
I tried to add .instance3_id##instance3_name##instance3_description but I am getting a message that there is no instance discovered!!! not sure what is wrong should I use another instance number?:
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}) + "##" `
+ $_.Subject + $(If ($_.Subject -ne "") {"(..." + $_.Thumbprint.SubString($_.Thumbprint.length - 5, 5) + ")"} Else {"Unknown subject (" + $_.Thumbprint + ")"}) + "##" `
+ "##" `
+ "cert.issuer=" + $_.Issuer `
+ "&cert.friendlyname=" + $_.FriendlyName `
+ "&cert.serialnumber=" + $_.SerialNumber `
+ "&cert.thumbprint=" + $_.Thumbprint `
+ "&system.systemDescription=" + $_.instance3_id##instance3_name##instance3_description `
} `
| Format-Table -HideTableHeaders
Thanks,
Dom
Related Content
- 6 months ago