Invoke-TroubleshootingPack

Executes a troubleshooting pack in interactive or unattended mode to fix a problem, and then generates a resultsreport.
Invoke-TroubleshootingPack [-answer <string>] [-result <string>] [-unattend] [-pack*] <Diagpack>[<CommonParameters>]

The Invoke-TroubleshootingPack cmdlet runs a troubleshooting pack using the object that you get by using the Get-TroubleshootingPack cmdlet.

This cmdlet can be run in two modes: interactive and unattended

— In interactive mode, the questions are displayed at the console and the user can run resolvers selectively.

— In unattended mode, Invoke-TroubleshootingPack runs in the background and, if it detects a root cause, it runs the corresponding resolvers in a predetermined order.

If a troubleshooting pack that is running in unattended mode needs answers to questions in order to run, it can get the answers from the answer file that is associated with the troubleshooting pack. You can generate an answer file for a troubleshooting pack by using the Get-TroubleshootingPack cmdlet.

Invoke-TroubleshootingPack can generate an optional Result Report and Debug Report that contains information about the troubleshooting run, such as which root causes were found. The Debug Report can also contain exceptions that might have occurred during a troubleshooting pack execution. A troubleshooting pack might also add additional files, such as event logs, during its execution to the report folder. To direct Invoke-TroubleshootingPack to generate a Result Report and Debug Report, use the Result parameter to specify the path to where the Result Report and Debug Report will be generated and the additional files added.

Parameters
-answer <string>

Directs Invoke-TroubleshootingPack to look in the specified answer file for answers to questions. Enter the absolute, relative, or UNC path to the XML answer file for the troubleshooting pack.

An answer file contains the answers to questions that a troubleshooting pack might ask during its execution. To create an answer file, use the Get-TroubleshootingPack cmdlet.

-pack <Diagpack>

  • This value is required
  • Accepts pipeline input ByValue

Specifies the troubleshooting pack to run. Enter a variable that contains the troubleshooting pack object. To get the troubleshooting pack object, use the Get-TroubleshootingPack command.

You cannot submit a path as a value for the Pack parameter.

-result <string>

Directs Invoke-TroubleshootingPack to generate the Result Report and Debug Report. Enter an absolute, relative, or UNC path with no file name. If this parameter is not specified, then the Result Report and Debug Report will not be generated.

-unattend [<switchparameter>]

Invoke-TroubleshootingPack in unattended mode. By default, it runs interactively.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs

Microsoft.Windows.Diagnosis.Diagpack

This object, which is returned from Get-TroubleshootingPack, is passed into the cmdlet

Examples
  1. This command gets a troubleshooting pack using the Get-TroubleshootingPack command and passes it to Invoke-TroubleshootingPack to run:
    C:PS> get-troubleshootingpack -path C:WindowsDiagnosticsSystemAero | invoke-troubleshootingpack
    

    It uses a pipeline operator (|) to send the troubleshooting pack to the Invoke-TroubleshootingPack cmdlet, which runs the troubleshooting pack.

    Because Invoke-TroubleshootingPack is run without parameters, it uses all of the default values. It runs interactively, does not use an answer file, and does not create a Result Report and Debug Report.

  2. This command uses the Invoke-TroubleshootingPack cmdlet to run a troubleshooting pack and generate a Result Report and Debug Report:
    C:PS> $aero = get-troubleshootingpack C:WindowsDiagnosticsSystemAero
    invoke-troubleshootingpack -pack $aero -result C:DiagResult
    

    The first command uses the Get-TroubleshootingPack cmdlet to get an object that represents the troubleshooting pack at the specified location. It stores the object in the $aero variable.

    The second command uses the Invoke-TroubleshootingPack cmdlet to run the troubleshooting pack. The Invoke-TroubleshootingPack command uses the Pack parameter to specify the troubleshooting pack in the $aero variable and the Result parameter to specify the location of the Result Report and Debug Report.

  3. This command runs a troubleshooting pack in unattended mode with an answer file:
    C:PS> $aero = get-troubleshootingpack C:WindowsDiagnosticsSystemAero -answer AeroAnswerFile.xml
    invoke-troubleshootingpack -pack $aero -answer AeroAnswerFile.xml -unattend
    

    The first command uses the Get-TroubleshootingPack cmdlet to get an object that represents the troubleshooting pack at the specified location. It stores the object in the $aero variable. The command uses the Answer parameter of Get-TroubleshootingPack cmdlet to generate an answer file.

    The second command uses the Invoke-TroubleshootingPack cmdlet to run the troubleshooting pack in unattended mode. The command uses the Answer parameter of Invoke-TroubleshootingPack to direct the cmdlet to get answers to questions from the answer file.

Additional Notes
 Invoke-TroubleshootingPack requires a DiagPack object. To get the object, use the Get-TroubleshootingPack 
 cmdlet.

 If Invoke-TroubleshootingPack is running in unattended mode and the answer to a question is not found in the 
 answer file, then Invoke-TroubleshootingPack will return an error to the troubleshooting pack, and the 
 troubleshooting pack can continue or stop executing.
Related Links

Get-TroubleshootingPack