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.
This object, which is returned from Get-TroubleshootingPack, is passed into the cmdlet
- 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.
- 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.
- 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.
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.