To verify the presence of a certificate (based on a specific template) do this:

@echo off
cls
echo Check the presence of a certificate

echo —————————————–
echo.
if /I “%1” EQU “” goto USAGE
goto main

:USAGE
echo.
echo USAGE: CheckCertificatePresence.cmd templatename
echo.
echo ex: checkcertificatepresence.cmd AmadeusWorkstationAuthentication
echo ex: checkcertificatepresence.cmd KerberosAuthentication
echo.
goto end

echo.
:MAIN
echo.
echo The certificate template to found is: %1
echo.
echo In progress…
certutil -store my %1
echo.
if /I “%errorlevel%” EQU “0” (goto OK) else (goto KO)
:OK
echo.
echo SUCCESS: certificate is found
goto end
:KO
echo.
echo ERROR: certificate not found!
echo.
goto end
:end