Resolving COMOS Email Run-time Error 429 ActiveX Component

David Krause9 min read
HMI / SCADASiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Problem Overview

When configuring automated email notifications in Siemens COMOS (plant engineering, operation, and document management platform), the following dialog appears as soon as a script or event tries to send a message:

Run-time error '429': ActiveX component can't create object

This error originates in the COM automation layer used by COMOS to instantiate an Outlook.Application COM object. It is a generic VBScript / VBA failure that the COMOS scripting host surfaces to the user before the email is dispatched. Typical scenarios in which the message appears:

  • SMTP notification configured (for example, smtp.gmail.com:587 with TLS) but the underlying COMOS mail module still attempts an MAPI/Outlook call path.
  • Microsoft Outlook is not installed on the COMOS workstation or the 32-bit/64-bit mismatch prevents the COM class from registering.
  • Outlook is installed but its COM add-in layer is disabled (Office Click-to-Run, Group Policy, or a previous Office repair left Outllib.dll unregistered).
  • The workstation runs COMOS in a Remote Desktop Services (RDS) session where Outlook is not provisioned for the active user profile.

The error blocks automated document release notifications, approval workflow emails, and PDF report distribution. Because the dialog halts the calling script, batch jobs abort with non-zero exit codes and operators must re-trigger the workflow manually.

Root Cause Analysis

The Outlook.Application object is a COM automation server exposed by Outlook.exe (or Olk.exe on legacy builds). VBScript inside COMOS reaches it through a construct equivalent to:

Set oOApp = CreateObject("Outlook.Application")
Set oMail = oOApp.CreateItem(0)   ' olMailItem = 0
oMail.To = "[email protected]"
oMail.Subject = "COMOS notification"
oMail.Body = messageText
oMail.Send

The 429 error means the COM runtime cannot locate, instantiate, or load the requested class. Per Microsoft documentation (Microsoft KB 926226 — Run-time error '429' ActiveX component can't create object), the common causes are:

Cause Symptom Detection
Outlook not installed CreateObject("Outlook.Application") returns nothing Check HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE
32-bit/64-bit mismatch Error only when COMOS launched as 64-bit process Task Manager → Details → check Platform column
Outlook running with /safe switch COM disabled, no automation possible Inspect Outlook shortcut target line
Office Click-to-Run not synchronized Class not registered in registry Run regsvr32 olk.exe or repair Office
Antivirus / GPO blocking MAPI Outlooks starts but object creation denied Check HKCU\Software\Microsoft\Office\16.0\Outlook\Options\General
Profile not configured (no default MAPI profile) Class exists but Logon fails Control Panel → Mail (32-bit) → Show Profiles

When COMOS is configured for an external SMTP relay (such as Gmail on port 587) but its internal mail component still falls back to a MAPI/Outlook object for the From header lookup, the script hits the 429 path even though the SMTP server itself is healthy.

Architectural note: COMOS versions 10.x use a hybrid mail architecture. The MailAgent service handles outbound SMTP transport, but the envelope (sender display name, account resolution, profile lookup) is delegated to the local MAPI subsystem. Removing Outlook breaks the envelope stage even if the SMTP stage succeeds.

Prerequisites for Resolution

  1. Local administrator rights on the COMOS workstation.
  2. The COMOS log directory location (default: %LOCALAPPDATA%\Siemens\COMOS\Log or C:\ProgramData\Siemens\COMOS\Logs).
  3. Knowledge of the SMTP relay target (server, port, TLS/SSL mode, credentials).
  4. Microsoft Outlook installed at a version compatible with the COMOS release (see compatibility matrix below) or a pure SMTP path available.
  5. For deep logging: the COMOS /DG:D debug switch (Document Generation / Diagnostics) which raises the log verbosity level to DEBUG.

COMOS to Outlook Compatibility Matrix

COMOS Version Supported Outlook Notes
COMOS 10.2 2016, 2019 (32-bit) Click-to-Run supported from SP2
COMOS 10.3 2019, 2021, 365 (32/64-bit) Requires Office 16.0.14326+
COMOS 10.4.1+ 2021, 365 LTSC (32/64-bit) Use MatchOutlookVersion=1 in comos.ini

Step-by-Step Resolution

Step 1 — Capture a Verbose Log

Close all COMOS sessions. Launch COMOS from an elevated command prompt with the diagnostic switch:

cd "C:\Program Files\Siemens\COMOS\Work\bin"
Comos.exe /DG:D

Reproduce the email notification. The log file Comos.log will contain entries at DEBUG level that show the exact line where the COM instantiation failed. Look for tokens such as:

DEBUG [MailAgent] CreateObject("Outlook.Application") failed
ERROR  [MailAgent] HRESULT 0x80040154 — Class not registered
ERROR  [MailAgent] Workflow mail aborted at stage 3 (envelope)

Per Microsoft Learn community guidance and Microsoft KB 926226, the runtime error 429 is mapped to HRESULT 0x80040154 (REGDB_E_CLASSNOTREG) in the absence of a registered Outlook.Application class.

Step 2 — Verify Outlook Installation and Registration

  1. Confirm Outlook is installed:
    reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE"
    If the path is missing, Outlook is not installed on the workstation.
  2. Confirm the COM class is registered (run from C:\Windows\SysWOW64 for 32-bit Outlook on a 64-bit OS):
    reg query "HKCR\Outlook.Application\CLSID" /s
    Expected return: a CLSID GUID such as {0006F03A-0000-0000-C000-000000000046}.
  3. Try instantiation from a stand-alone VBScript outside COMOS:
    Set oOApp = CreateObject("Outlook.Application")
    If oOApp Is Nothing Then
      WScript.Echo "FAILED: Outlook.Application not creatable"
    else
      WScript.Echo "OK: Outlook version " & oOApp.Version
    End If
    If this script throws 429, the problem is at the OS/Office level, not COMOS.

Step 3 — Repair or Install Outlook

Condition Action
Outlook MSI, partially corrupted Control Panel → Programs → Microsoft Office → Change → Online Repair
Outlook Click-to-Run, class not registered Open Outlook once as the same user, close, retry COMOS
Outlook missing entirely Install the version matched to COMOS (see matrix), then reboot
32/64-bit mismatch Match COMOS bitness to Outlook bitness (most COMOS builds are 32-bit)

Step 4 — Configure a Pure SMTP Path (Outlook-Free)

If Outlook cannot be installed (RDS farm, locked-down workstation, or licensing restrictions), switch the COMOS mail agent to its pure-SMTP mode. Edit the project configuration and the registry/INI as shown:

  1. In COMOS, open the project properties → Mail settings.
  2. Set the transport mode to SMTP (not MAPI).
  3. Enter the relay server. For Gmail with app-password authentication:
    Mode        = SMTP
    Server      = smtp.gmail.com
    Port        = 587
    Encryption  = STARTTLS
    AuthUser    = [email protected]
    AuthPass    = <16-character App Password>
    FromAddr    = [email protected]
  4. Add or modify the registry key that disables the Outlook envelope lookup:
    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\COMOS\MailAgent]
    "UseOutlookEnvelope"=dword:00000000
    "ForceSmtpTransport"=dword:00000001
  5. Restart the COMOS MailAgent service and the COMOS client.
Security: Gmail no longer accepts plain password authentication from arbitrary clients. Generate an App Password under Google Account → Security → 2-Step Verification → App passwords, then use the 16-character string as AuthPass. Do not commit the password to plain-text INI files; use the COMOS credential vault when available.

Step 5 — Add Defensive Scripting

For users who keep MAPI path (mixed environments with and without Outlook), wrap the COM instantiation in a VBScript guard. This is the standard pattern referenced in COMOS custom-script guides:

On Error Resume Next
Set oOApp = CreateObject("Outlook.Application")
If Err.Number <> 0 Then
    WScript.LogEvent 2, "Outlook.Application unavailable (" & Err.Number & _
                       "). Falling back to SMTP-only path."
    Err.Clear
    ' Call the SMTP-only branch
    Call SendMail_SmtpOnly(toAddr, subject, body)
else
    Set oMail = oOApp.CreateItem(0)
    oMail.To = toAddr
    oMail.Subject = subject
    oMail.Body = body
    oMail.Send
End If
On Error Goto 0

This pattern prevents the 429 dialog from halting the script. The Err.Clear after the check is mandatory; otherwise the next statement inherits the stale error state.

Verification

  1. Send a test notification from the COMOS document workflow: right-click a document → Send to → Mail recipient.
  2. Confirm the message arrives in the test mailbox within 60 seconds (default poll interval of the MailAgent).
  3. Inspect the Comos.log for the line INFO [MailAgent] Message dispatched via SMTP (msg-id=…).
  4. Repeat the same test from the same workstation with Outlook deliberately stopped (taskkill /IM outlook.exe /F) — the SMTP path should still succeed.
  5. If running in RDS, repeat for every user profile; the MAPI profile is per-user.

Troubleshooting Matrix

Symptom after fix Likely cause Remediation
429 still appears, log shows class registered Antivirus / EDR blocking outlk.exe automation Add Outlook to EDR allow-list or whitelist the COM CLSID
Mail not delivered, no error dialog Wrong FromAddr or SPF/DMARC block Check Gmail Sent and SMTP response codes in log
Works for one user, fails for another Missing Outlook profile under second user Launch Outlook once as that user to create default profile
Slow delivery (10+ minutes) MailAgent poll interval too long Lower PollIntervalSec in comos.ini from 300 to 30
0x80004005 instead of 429 Trust center macro / SmartScreen block Lower macro security in Trust Center or sign the COMOS macro
0x80040154 on Windows Server Core Outlook cannot install on Server Core Switch to pure-SMTP transport (Step 4)

Edge Cases and Field Notes

Case A — Office 365 (Click-to-Run) on RDS: Microsoft Click-to-Run is the only Office delivery channel supported on Windows Server 2022 RDS. The first interactive launch of Outlook by each user must complete a one-time activation handshake; until that completes, the COM CLSID is registered but instantiation fails. Schedule an unattended outlook.exe /profiles warm-up at user logon via Group Policy Preferences.

Case B — Comos running in 64-bit mode with 32-bit Outlook: Some COMOS 10.4 installers default to 64-bit when Microsoft.VC90.CRT is detected. The 64-bit host cannot bind to a 32-bit in-proc COM server. Verify with Comos.exe --check-bitness (if exposed) or by inspecting comos.ini → [General] Bitness=64. Force the matching bitness with the COMOS installer switch /BITNESS=32.

Case C — COMOS in a Citrix / published desktop: The 429 error is often reported only by the second simultaneous user. The MAPI subsystem in Office does not support multiple instances per machine by default; install the Microsoft hotfix KB 2643676 or set HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Options\General\AllowMultipleInstances = 1.

Case D — Group Policy disables MAPI: Some hardening templates set HKLM\Software\Microsoft\Office\16.0\Outlook\Options\General\DisableOutlookScripting = 1. This blocks all COM automation, including legitimate COMOS calls. Either remove the GPO or add COMOS to the policy exclusion list.

Prevention Checklist

  • Document the COMOS-to-Outlook compatibility matrix in the workstation build guide.
  • For new deployments, prefer the pure-SMTP path with a hardened relay (no Outlook dependency).
  • Centralize the SMTP credential in the COMOS credential vault or a Windows credential manager entry; never embed in comos.ini.
  • Validate the mail pipeline quarterly with a synthetic notification test (script in the project scheduler).
  • Monitor Comos.log for the string HRESULT 0x80040154 and alert before users hit the 429 dialog.

FAQ

What HRESULT corresponds to Run-time error 429 in COMOS mail scripts?

The 429 dialog maps to HRESULT 0x80040154 (REGDB_E_CLASSNOTREG) when Outlook is missing, or to HRESULT 0x80080005 (CO_E_SERVER_EXEC_FAILURE) when the class exists but cannot start. Inspect Comos.log (run with /DG:D) for the exact code.

Can I send Gmail notifications from COMOS without installing Outlook?

Yes. Configure the MailAgent transport to SMTP, point it at smtp.gmail.com:587 with STARTTLS, and set the registry value UseOutlookEnvelope = 0 under HKLM\SOFTWARE\Siemens\COMOS\MailAgent. Use a Google App Password, not the account password.

Why does the error appear for some users and not others on the same RDS host?

Outlook MAPI profiles are per-user. The first user to launch Outlook provisions the default profile; subsequent users inherit a session only if multiple-instance support is enabled. Either publish a warm-up script at logon or move to the pure-SMTP transport.

Which COMOS debug switch raises the log verbosity to diagnose the failure stage?

Launch COMOS with Comos.exe /DG:D. The /DG switch enables Document Generation diagnostics; append :D for the DEBUG level. The expanded log lists every COM instantiation attempt and the resulting HRESULT.

Does COMOS support 64-bit Outlook, or must the COMOS client be 32-bit?

COMOS 10.3 and later support 64-bit Outlook when the COMOS client itself is launched in 64-bit mode. Earlier 10.2 builds require 32-bit Outlook. Match the bitness of the COMOS process to the bitness of Outlook or use the pure-SMTP path to avoid the constraint entirely.

Back to blog