mdediag.dll Error in Windows 10 and 11: Defender for Endpoint diagnostics

A managed device may fail to collect Defender for Endpoint troubleshooting information even while its main Windows Security app opens.
The Windows file inventory identifies mdediag.dll as Microsoft Defender for Endpoint Diagnostic Engine. Capture the actual error, file path and Windows build before making changes.
Check where the error occurs
Check with your organization whether the device is onboarded. Record the time and verify that you are using the current official diagnostic package.
Repair the affected feature
Have the administrator use Microsoft’s supported Client Analyzer and correct access or onboarding issues. Protect collected diagnostic files as internal support data.
If Windows reports corruption of a protected system file, use Microsoft’s system file repair procedure. Obtain software and drivers through Windows Update or the applicable publisher.
Verify the repair
Verify that the analyzer completes and includes the expected device and connectivity checks.
See the publisher’s guidance, the exact Windows file record, and the related PC Repair Atlas guide.