Windows has evolved over the years with various tools to diagnose and repair issues. Everyone probably remembers the in-box tools to repair wireless connections in Windows XP. They started getting better in Windows Vista, then Windows 7 comes along with PowerShell in-box and an engine to diagnose, repair, and validate fixes automatically. If you open “Control Panel\All Control Panel Items\Troubleshooting” on a Windows 7 machine, you will see all of the in-box Troubleshooters to diagnose and repair things like network connections, Aero desktop effects, and audio playback. What you may not know is that you can build your own Troubleshooters, so they look and feel just like the in-box items and troubleshoot issues specific to your environment. You might have been doing this for a while with custom scripts, but now you can convert those so they look like the ones natively in Windows-in this article, I will tell you how.
This is an image of a custom troubleshooter I built to diagnose and repair issues with a custom application and connection broker called IT Connection Manager. In this case, I needed to look for a service state required by the application and correct it if not set correctly. The first thing you need to do is download and install the Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 (Could the title be longer? Yes, we could have spelled out “SDK” and “SP.”) Once installed, the tool you’ll need to use is the Windows Troubleshooting Pack Designer in the Tools folder of the SDK in your Start menu.
A Troubleshooting Pack consists of Root Causes and each Root Cause has: a Troubleshooter to detect issues, a Resolver to fix issues if detected, and a Verifier to see if the Resolver worked (usually you would rerun the Troubleshooter script for the Verifier). Each of these items contains simple rules, but the scripts are where the actual detection and fixing is done.
PowerShell is the scripting engine behind the Windows Troubleshooting Platform and anything you can do in PowerShell can be integrated into your Troubleshooting Packs.
Once you’ve defined your root causes and written your Troubleshooter, Resolver, and (optional) Verifier scripts, you can create the Troubleshooting Pack by clicking on the Build menu item in the Designer and selecting Build Pack. The output of the Designer and the Troubleshooter itself is a .diagcab file and the file once finished needs to be code-signed for the Troubleshooter to work.
That was just a crash course on building Troubleshooting Packs. For more information, check out the TechNet Library articles for the Windows Troubleshooting Platform.