Monthly Archive



I started thing about the troubleshooting packs we were looking at in the last post.  They are good but getting to them is a bit too hard.  We can short cut some of it by creating a PowerShell drive.  One of the great things about PowerShell is the provider system that exposes different data stores as if they were the file system – well this works for the file system as well.

Import the module as before

Import-Module troubleshootingpack

We don’t need a path because it is in the modules folder of the PowerShell install directory so it is automatically found.

Next thing we do is create a drive

New-PSDrive -Name tspack -PSProvider FileSystem -Root "C:\Windows\diagnostics\system" -Description "Maps to the troubleshooting packs"

Now when we look at the drives

PS> Get-PSDrive

Name       Provider      Root
----       --------      ----
Alias      Alias
C          FileSystem    C:\
cert       Certificate   \
D          FileSystem    D:\
E          FileSystem    E:\
Env        Environment
Function   Function
HKCU       Registry      HKEY_CURRENT_USER
HKLM       Registry      HKEY_LOCAL_MACHINE
tspack     FileSystem    C:\Windows\diagnostics\system
Variable   Variable
WSMan      WSMan

Notice our new drive.

We can now access the troubleshooting system like this

PS> ls tspack:

    Directory: C:\Windows\diagnostics\system

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        13/12/2008     15:33            AERO
d----        13/12/2008     15:33            Audio
d----        13/12/2008     15:33            Device
d----        13/12/2008     15:33            DeviceCenter
d----        13/12/2008     15:33            HomeGroup
d----        13/12/2008     15:33            IEBrowseWeb

Yes Virginia I did use an alias.  Its only in scripts or published stuff that  I don’t like them.

And we can use the packs

Get-TroubleshootingPack -Path tspack:\networking

If you are going to be using these things a lot then the two lines

Import-Module troubleshootingpack

New-PSDrive -Name tspack -PSProvider FileSystem -Root "C:\Windows\diagnostics\system" -Description "Maps to the troubleshooting packs"

should be added to your profile or loaded as a function for immediate use.

The psdrive functionality can be used to create a lot of shortcuts like this.


Leave a Reply