Collects and analyzes data relevant to the operation of a guarded fabric.
PowerShell · Risk: Low · Documentation Verified
Last verified: 2026-10-26
Microsoft HgsDiagnostics reference: Collects and analyzes data relevant to the operation of a guarded fabric. The syntax and selected example below are adapted from the pinned Windows Server 2025 reference. Module availability, target configuration and delegated permissions determine whether it can run in your environment. Documentation and parameter text: Microsoft, CC BY 4.0; formatting adapted by Cmdlet World. No execution testing is claimed.
Use an account with the target resource permissions documented for Get-HgsTrace. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Supported environments
Windows / HgsDiagnostics · Windows Server 2025 documentation; feature/module prerequisites apply
Parameters
-Collector
Specifies a list of collectors to be executed when gathering traces. This parameter is used to collect only specific traces when you do not specify a list of diagnostics and you do not run diagnostics with the *RunDiagnostics* switch.
-Compact
Indicates that the output object is provided should be a minimal subset of the results generated instead of the complete result set. This switch parameter is ignored if more than one target is provided.
-Detailed
Specifies that the output object has full details, which includes all results omitted from the default output report.
-Diagnostic
Specifies a list of diagnostics that are run if you also provide the *RunDiagnostics* switch parameter. If you do not provide the *RunDiagnostics* switch parameter, this list of diagnostics is used to determine which collectors are executed. Diagnostics and collectors whose requirements are not satisfied by the provided targets will not be executed.
-Path
Specifies an absolute or relative path to a folder where trace files are stored. If the folder already exists, any traces contained therein are reused. New traces are collected to augment existing traces if they are missing from the pre-populated traces.
-RunDiagnostics (required)
Indicates that diagnostics are immediately run against the collected traces and that the result set describes the result of diagnosing the collected information.
-Target
Specifies a list of targets created by New-HgsTraceTarget to be traced and diagnosed. If no targets are provided, but a collection path has been specified, the path is searched for pre-existing traces to be analyzed. If none are found, the localhost is targeted using the current session's credentials inferring the host's role from installed Windows features.
-WriteManifest
Indicates that a manifest of all trace files collected are written. This can then be used by the Get-HgsTraceFileData cmdlet to get secured information about trace files.
Prerequisites
Windows with the HgsDiagnostics module and the Windows feature or management tools that provide it. Confirm target connectivity and version compatibility using the linked Microsoft reference.
Security considerations
This is a read-oriented cmdlet; protect any sensitive results and check the documented effects of your selected parameters.
Examples
Example 1: Diagnose the local host
Get-HgsTrace -RunDiagnostics
This command diagnoses the local host. The traces are stored in a temporary folder and diagnosis results are reported to the user. Source: Microsoft, CC BY 4.0; transcript prompt/output removed. This example was not executed.