Jump to content

certificate search by thumbprint


iamtheky
 Share

Recommended Posts

#include<array.au3>

_ArrayDisplay(_GetCertByThumb(""))  ;~ "A1B9894B9BB100F43A229D65CC3C306FBF0BB9F8"


Func _GetCertByThumb($sThumbprint = "")

   $sCommands = 'Powershell get-childitem -Path Cert:\CurrentUser -Recurse -Name | FindStr /L "\\"' & $sThumbprint
   $iPID = Run(@ComSpec & " /c " & $sCommands, "", @SW_HIDE , $stdout_child)

   $sOutput = ""

          While 1
                 $sOutput &= StdoutRead($iPID)
                 If @error Then
                     ExitLoop
                 EndIf
          WEnd

      $aRtn = stringsplit($sOutput , @LF , 2)

      _ArrayDelete($aRtn , ubound($aRtn) - 1)

   If ubound($aRtn) < 1 then _ArrayAdd($aRtn , "No Match Found")

   Return $aRtn

EndFunc

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...