Jump to content

Recommended Posts

Posted

Hi everyone

 

I've been looking around but I can't seem to find any posts on this...

Is there an easy way to get the error description for a hex error code?

When I run certutil from within autoit it returns an error code but nothing else if there is a problem

I'd like to convert the code to the actual description.

 

Thx for the help

Colombeen

Posted

Can you please post an example of the error code you are talking about?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

When i run the following cmd I get the error code plus description:

Quote

C:\Users\xx>certutil asdf
CertUtil: -dump-Befehl ist fehlgeschlagen: 0x80070002 (WIN32: 2)
CertUtil: Das System kann die angegebene Datei nicht finden.

So you could simply extract the error message from the data returned by certutil.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Another possible way is to extract the windows error code and run net helpmsg.

Quote

net helpmsg 2

which returns the same error message.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

certutil only returns this to autoit : -2147024810 (Hex: 80070056)

in this case: a bad password for the pfx file

Edited by colombeen
Posted

How do you call certutil in your AutoIt script?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
Just now, water said:

How do you call certutil in your AutoIt script?

Local $DGCERTINST_COMMAND = 'certutil -f -user -p "' & $DGCERTINST_PASSWORD & '_" -importpfx "' & $DGCERTINST_CERT_PATH & '"'
Local $DGCERTINST_TRY_INSTALL = RunWait($DGCERTINST_COMMAND, "", @SW_HIDE)

$DGCERTINST_TRY_INSTALL contains the return code

Posted (edited)

You could grab the output of certutil and extract the error message.

#include <AutoItConstants.au3>
Local $iPID = Run("Certutil afds", "", Default, $STDOUT_CHILD)
; Wait until the process has closed using the PID returned by Run
ProcessWaitClose($iPID)
; Read the Stdout stream of the PID returned by Run
Local $sOutput = StdoutRead($iPID)
ConsoleWrite("StdOut: " & $sOutput & @CRLF)

 

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

A bit more elaborated:

#include <AutoItConstants.au3>
#include <StringConstants.au3>

Local $iPID = Run("Certutil afds", "", Default, $STDOUT_CHILD)
; Wait until the process has closed using the PID returned by Run
ProcessWaitClose($iPID)
; Read the Stdout stream of the PID returned by Run
Local $sOutput = StdoutRead($iPID)
Local $aMessage = StringSplit($sOutput, @CRLF, $STR_ENTIRESPLIT)
If IsArray($aMessage) And $aMessage[0] > 1 And StringInStr($aMessage[1], "(Win32: ") Then
    ConsoleWrite("Error returned by certutil:" & @CRLF & $aMessage[2] & @CRLF)
EndIf

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
1 hour ago, water said:

A bit more elaborated:

#include <AutoItConstants.au3>
#include <StringConstants.au3>

Local $iPID = Run("Certutil afds", "", Default, $STDOUT_CHILD)
; Wait until the process has closed using the PID returned by Run
ProcessWaitClose($iPID)
; Read the Stdout stream of the PID returned by Run
Local $sOutput = StdoutRead($iPID)
Local $aMessage = StringSplit($sOutput, @CRLF, $STR_ENTIRESPLIT)
If IsArray($aMessage) And $aMessage[0] > 1 And StringInStr($aMessage[1], "(Win32: ") Then
    ConsoleWrite("Error returned by certutil:" & @CRLF & $aMessage[2] & @CRLF)
EndIf

 

thx water, i'll try this in a few mins

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...