Microsoft.PowerShell.Diagnostics module: setup and commands
Documentation: Microsoft Learn
Read Windows event and diagnostic data with Get-WinEvent and related cmdlets while filtering at the provider instead of after retrieval.
Getting it
Part of the Windows install of PowerShell. Both cmdlets are Windows only and are absent from Linux and macOS builds.
Examples
Show reference output
Show reference output
What it is for
Use Get-WinEvent whenever events need filtering on the server side rather than being pulled in bulk and filtered afterwards. Get-Counter suits a short live sample of processor or memory counters when standing up real monitoring would be overkill.
Typical tasks
- Pull errors and warnings from the last day
- Filter security events by event ID
- Read an application-specific event channel
- Sample processor and memory counters
- Correlate a failure window across two logs
- Export events for offline review
Check the installed version
Compare the module path and version with the session used by your scheduled task or automation account. Use Get-WinEvent whenever events need filtering on the server side rather than being pulled in bulk and filtered afterwards. Get-Counter suits a short live sample of processor or memory counters when standing up real monitoring would be overkill.