cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
214
Views
0
Helpful
0
Replies

Powershell script for cisco ise posture check

Debabrata Majhi
Level 1
Level 1
 
Hi Expert ,
 
I need a help for fixing a powershell script ,I want to setup a script to check a system certficate in VPN posture check ,If the certificate found it will pass else fail.
 
I am unable to put command in scrip through which Cisco ISE will understand it pass and fail , If I set script condition fail ,It fail all system where I can see the certificate post run the below script manualy .
May you please help here 
 
 
Here is the sample below script 
 
#Define the certificate store and location
$storeName = "CA"
$storeLocation = "LocalMachine"
 
# Define the thumbprint of the certificate you are looking for
$SubjectToFind = "subject"
 
# Open the certificate store
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store($storeName, $storeLocation)
$store.Open("ReadOnly")
 
# Find the certificate
$certificate = $store.Certificates | Where-Object { $_.Subject -eq $SubjectToFind }
 
# Display the certificate details if found
if ($certificate.Count -gt 0) {
    Write-Output "Certificate found:"
    Write-Output "Subject: $($certificate.Subject)"
    Write-Output "Issuer: $($certificate.Issuer)"
    Write-Output "Thumbprint: $($certificate.Thumbprint)"
    Write-Output "count : $($Certificate.Count)"
} else {
    Write-Output "Certificate not found."
}
 
# Close the store
$store.Close()
0 Replies 0