def get_cert_serial(cert_file):
 cmd = 'certutil.exe -verify {0}'.format(cert_file)
 out = __salt__['cmd.run'](cmd)
 matches = re.search('Serial: (.*)', out)
 if (matches is not None):
  return matches.groups()[0].strip()
 else:
  return None

def get_cert_serial ( cert_file ) : cmd = 'certutil.exe -verify {0}' . format ( cert_file ) out = __salt__ [ 'cmd.run' ] ( cmd ) matches = re . search ( 'Serial: (.*)' , out ) if ( matches is not None ) : return matches . groups ( ) [ 0 ] . strip ( ) else : return None
get the serial number of a certificate file cert_file the certificate file to find the serial for cli example: .