Microsoft.PowerShell.Commands.Diagnostics.dll Error in Windows 10 and 11

If PowerShell reports Microsoft.PowerShell.Commands.Diagnostics.dll while running Get-WinEvent, first check whether Windows can read the same event log through Event Viewer. Then test the built-in Windows PowerShell host with profiles disabled. This comparison lets you repair the affected tool or script with a much smaller set of changes than a general Windows repair.
What owns the DLL
Microsoft’s GetWinEventCommand reference identifies Microsoft.PowerShell.Commands.Diagnostics.dll as the assembly that implements the command. The Windows servicing inventory records the assembly for both Windows 10 and Windows 11. Windows PowerShell and current PowerShell can coexist on the same PC, and each runs from its own installation. Record whether the original error came from powershell.exe, pwsh.exe, a terminal profile, or a program that hosts PowerShell. A command that runs in one host can still fail in another.
Before repairing anything, keep the complete first error. A message about an inaccessible log, a provider query that returned no matches, and a message that an assembly cannot load point to different starting checks. Note the exact command, log or provider name, machine, approximate time, and whether the script was running under your account or a configured task account. Share only the relevant error and redact private paths, account names, or event data before sending it to anyone.
Compare one local event log
Open Event Viewer from Start, expand Windows Logs, and select Application. Note whether it opens and whether you can select a recent entry. Use the same account you used for PowerShell where practical. If Event Viewer opened under a different account or elevation level, record that difference before interpreting the result. This test reads a local log and does not remove or change events.
Open a new Windows PowerShell session with profiles disabled, then run the small comparison below. Leave the original window open so you can compare its output. Get-Command checks whether the host exposes the command. The second line asks for a small number of recent Application log records and reduces the displayed output to three columns. Microsoft documents both log names and the record limit in its Get-WinEvent guide.
powershell.exe -NoProfile
Get-Command Get-WinEvent | Select-Object Name, Source, Version
Get-WinEvent -LogName Application -MaxEvents 5 | Select-Object TimeCreated, Id, ProviderName
If both tools show Application events but your original command fails, repeat the original command without its extra filter first. Then add its log, provider, time range, and event ID constraints back one at a time. A filter can exclude every event even when the tool works. Verify the intended provider and log on that machine, especially if the working example came from another computer. For remote reads, confirm the service or task account’s approved access with the administrator before changing connection settings.
If Event Viewer opens Application but the clean PowerShell host fails before it can list the command or query, copy the first assembly or module error and confirm your engine with $PSVersionTable. If only the normal session fails, inspect recent profile or module changes and test the original command in a clean session again. Ask the script owner to confirm its runtime requirements before modifying an environment used for automation. A working pwsh.exe session does not show that a task written for Windows PowerShell can switch engines without testing.
If both tools fail to open the same log, note whether a second normal log, such as System, opens from the same account. The administrator can check the Windows Event Log service and the organization’s logging or permissions policy. Keep the logs intact while investigating. For failures affecting several channels or applications, the PC Repair Atlas Wevtapi.dll guide has a separate Event Log troubleshooting path. If only the Event Viewer window closes, compare the symptoms with the EventViewer.dll guide.
Repair the installation that actually failed
Use the supported update or repair route for the engine named in the original error. For an independently installed PowerShell release, confirm its installation source and version first. For built-in Windows PowerShell, finish any pending supported Windows updates and restart if requested. If multiple built-in commands are failing with matching Windows assembly errors or a Windows diagnostic points to damaged protected files, use Microsoft’s Windows component repair procedure under an authorized administrator account. Run the documented repair commands in their recommended order, then record the results and the next test. Avoid copying assemblies between PowerShell installations or downloading a standalone DLL.
Verify the original query
Run the small local Application query again from the same host and account that previously failed. A successful control returns recent records without the assembly error. Then run the original query with the original filter and verify that it returns the expected event or completes successfully for the intended input. If the query runs but returns no matching records, check the time window and compare with Event Viewer before treating that result as a recurrence. Also rerun the actual script or scheduled task once through its normal entry point, where appropriate. Keep a note of the engine version, tested log, and first result that changed. Those details distinguish a repaired PowerShell host from a filter or access problem that still needs attention.