Partilhar via


Windows Troubleshooting Platform meta-pack example

Today I thought I'd briefly touch on a new troubleshooting concept-- the meta-pack.  A meta-pack is a logical grouping of multiple Windows Troubleshooting Packs which can then be executed as one.  You can use a meta-pack to group similar troubleshooting tasks or to extend the functionality of an existing diagnostic without having to modify the original code.  For example, rather than build a new troubleshooting pack that addresses basic networking plus your configuration-specific root-causes you can create a meta-pack that includes the Windows 7 networking troubleshooter plus your configurations-specific troubleshooter, giving you the basic network troubleshooting for free.

I've attached a sample DiagCab file that illustrates this concept by combining the Windows 7 maintenance, audio, printer, and aero troubleshooters into one meta-pack.   

The contents of the DiagCab is quite simple.  It contains one file called "metapack.diagcfg" which defines the meta-pack.  The contents of the file is provided below.  Transforming this file into a meta-pack is simply a matter of cabbing up the file and changing the extension from ".cab" to ".diagcab". 

<?xml version="1.0" encoding="utf-8"?>

<PackageConfiguration xmlns="https://www.microsoft.com/schemas/dcm/configuration/2008">

    <Execution>

        <Package Path="%windir%\diagnostics\scheduled\Maintenance"/>

        <Package Path="%windir%\diagnostics\system\audio"/>

        <Package Path="%windir%\diagnostics\system\printer"/>

        <Package Path="%windir%\diagnostics\system\aero"/>

    </Execution>

</PackageConfiguration>

If you wanted to extend a Windows 7 Troubleshooting Pack then the XML and directory structure would look something like this.  Note that the first package entry points to a folder called "MyAppDiag"; this is the folder that contains your completed diagnostic, which must be included.  Cab the whole thing up, rename to .diagcab, and you're ready to go!

Contents of .DiagCfg

<?xml version="1.0" encoding="utf-8"?>

<PackageConfiguration xmlns="https://www.microsoft.com/schemas/dcm/configuration/2008">

    <Execution>

        <Package Path="MyAppDiag"/>

        <Package Path="%windir%\diagnostics\system\audio"/>

    </Execution>

</PackageConfiguration>

Directory Structure of .DiagCab

.\Metapack.diagcfg

.\MyAppDiag

.\MyAppDiag\DiagPackage.cat

.\MyAppDiag\MyAppDiag.diagpkg

.\MyAppDiag\*.ps1

-mb

MetaPack.diagcab