大网数据广告活动
启动与系统组件

CreateProcessWithLogonW fails when called on a Microsoft Entra account

· 52CE 我爱测

Describes an error that may occur when an application calls CreateProcessWithLogonW on a Microsoft Entra account in UPN format.

The CreateProcessWithLogonW function may fail when you call it by setting lpDomain to a Microsoft Entra ID (formerly known as Azure Active Directory) account in UPN format.

Symptoms

The CreateProcessWithLogonW function documentation states that the lpDomain parameter must be set to NULL if lpUsername is in UPN format.

However, the CreateProcessWithLogonW function may fail, and the GetLastError function returns ERROR_LOGON_FAILURE (1326) or another error code on Windows 10 and Windows 11 when the following conditions are met:

  • The lpUsername parameter is set to a Unicode string containing a Microsoft Entra account, specified in UPN format.

  • The lpDomain parameter is set to NULL.

Cause

Microsoft has confirmed this is a problem in Windows 10 and Windows 11.

Workaround

To work around this issue, follow these steps:

  1. Call CreateProcessWithLogonW by setting the lpUsername parameter to a user account in UPN format and the lpDomain parameter to NULL.

  2. If step 1 fails, call CreateProcessWithLogonW again with the lpDomain parameter set to AzureAD.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors (upstream author metadata: cts-davean). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 06/11/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。