Have you ever thought of executing Windows Troubleshooting Packs from command line? It is now possible to execute the Windows Troubleshooting Packs from a command line on a computer running Windows Server 2012 and later. You can use built-in Windows PowerShell modules to do so. You can even create an answer file to answer the questions without any user intervention.
All the Windows Troubleshooting Packs are located in C:\Windows\Diagnostic\System folder. You may need to run the below PowerShell command to get the list of all available Windows Troubleshooting Packs before you can execute them:
- Get-ChildItem C:\Windows\Diagnostic\System
To start the troubleshooting pack, run the below command from an elevated PowerShell window:
- Invoke-TroubleshootingPack (Get-TroubleshootingPack C:\Windows\diagnostics\system\networking)
The above command executes the “Networking” troubleshooting pack with questions being displayed in the command window. If you need to automate the process, you can create an answer file using the Get-TroubleshootingPack PwoerShell cmdlet as shown below:
- Get-TroubleshootingPack C:\Windows\diagnostics\system\networking -AnswerFile c:\AnswerFiles\answer.xml
Once the answer file is created, run the below command with answer file:
- Invoke-TroubleshootingPack (Get-TroubleshootingPack C:\Windows\diagnostics\system\Networking) -AnswerFile c:\AnswerFiles\answer.xml
About Nirmal Sharma
Nirmal is a MCSEx3, MCITP and was awarded Microsoft MVP award in Directory Services. He is specialized in Directory Services, Microsoft Clustering, Hyper-V, SQL and Exchange and has been involved in Microsoft Technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles. Nirmal can be reached at [email protected].
Hi,
When i have ran Invoke-TroubleshootingPack (Get-TroubleshootingPack C:\Windows\diagnostics\system\Windowsupdate) -AnswerFile c:\AnswerFiles\answer.xml
It is showing
“Check for pending updates
[1] Download and Install Pending Updates”
I want to fix automatically instead of asking. what i do please let me know.
Thanks
im pretty sure this was copied straight from the MS website
Good stuff! Thanks
FYI… typo last line below needs corrected to Diagnostic’S’\System missing S
All the Windows Troubleshooting Packs are located in C:\Windows\Diagnostic\System folder. You may need to run the below PowerShell command to get the list of all available Windows Troubleshooting Packs before you can execute them:
•Get-ChildItem C:\Windows\Diagnostic\System