| Richard's profileRichard Siddaway's BlogPhotosBlogLists | Help |
|
March 06 PSDriveI 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 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 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.
TrackbacksThe trackback URL for this entry is: http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!2126.trak Weblogs that reference this entry
|
|
|