Windows计划任务创建Word OLE客户端时触发ntdll应用程序错误的技术求助
Our regular workflow uses Windows Task Scheduler to execute three core steps: batch-convert RTF files to PDF, process PDFs to add barcodes, merge into a single PDF, and send to print. This worked flawlessly on Windows Server 2008, but after upgrading to Windows Server 2019 (due to end-of-support), we're stuck on the first step—we can't consistently instantiate the Word OLE client. The behavior is erratic: sometimes the process completes successfully, other times it fails immediately.
Our task triggers a Dyalog APL workspace where the business logic lives. To debug, I wrote a simplified version of the core code:
tries←0 ⍝ Initialize attempt counter Log'Attempting to create Word instance' ⍝ Log: Trying to create Word instance ⍝ :Repeat ⍝ Keep trying... Word←⎕NEW'OleClient'(⊂'ClassName' 'Word.Application') ⍝ Create Word client instance Word.Visible←1 ⍝ Make application visible tries+←1 ⍝ Increment counter after each attempt Log'Try: ',⍕tries ⍝ Log: Attempt number ⍝ :Until #.Word.PropList∊⍨⊂'Documents' ⍝ Until instance is successfully created (detect Documents property) ⍝ :OrIf tries≥maxTries_create ⍝ Or max attempts are reached (currently 5) ⍝ 'doc open'delayAndLog dl_open ⍝ Optional external delay and log... myWordDoc←Word.Documents.Open⊂docPath ⍝ Open specified test document ⍝ 'doc close'delayAndLog dl_close ⍝ Optional external delay and log... myWordDoc.Close 0 ⍝ Close document (no save) ⍝ 'application quit'delayAndLog dl_quit ⍝ Optional external delay and log... Word.Application.Quit 0 ⍝ Exit Word client
Note: Various delay parameters are stored in an external config file, so the config reading logic isn't included here. I added a retry mechanism for instance creation because sometimes the instance only initializes basic methods—adding delays or retries seemed to resolve the issue temporarily.
This simplified code runs perfectly on non-production servers, and sometimes works in production too. It never fails when run via the IDE, but when executed as a Windows Scheduled Task, opening the document throws a DOMAIN ERROR. I've observed that the WINWORD.exe process is briefly created (visible in Task Manager), then goes into a "Suspended" state before disappearing entirely. In Event Viewer, we see an ntdll application crash event with ID 1000.
Troubleshooting Steps Attempted
- Restarted the server
- Repaired Office installation
- Reinstalled Office
- Ran the scheduled task under a user with local admin privileges
- Configured and ran the task on other servers
- Increased the scheduled task's priority
- Set the Word instance to visible to check for popup errors
- Created a simplified task to rule out complexity in the main task
- Disabled "Automatically Ink" per Microsoft recommendations
- Captured procmon logs (awaiting Microsoft review)
Environment Details
- Word: Microsoft Word 2019 MSO (16.0.10374.20040) 64-bit
- Dyalog APL: 16.0.35960.0 32-bit Unicode
- Windows Server: 2019 Standard Version 1809, OS Build 17763.1697
I'm stuck troubleshooting this "Schrödinger's OLE Client" issue—any technical guidance would be greatly appreciated.
内容的提问来源于stack exchange,提问作者James Heslip

