Y'all know I love powershell.

But I'm getting pretty tired of the lack of consistency in the product.  I'm not speaking of quality here - just about how to get things done.  Case in point: at the moment I'm trying to figure out the new modules feature, which so far hasn't been difficult.  The most annoying thing is that I keep trying to get the list of available modules by typing this:

dir module:

which works for other powershell internals like variables:

dir variable:

and functions:

dir function:

but not for modules.  Why doesn't it work?  Well, those little drive-letter-type-monikers need something called a provider to enable them.  There's one built-in to powershell to enable this feature for variables and functions, but not for modules.

Not a big deal really, but one of the original selling points of powershell was its consistency - files, registry, certificates, etc., they all look like a little file system when you work with them.  So the act of adding, removing, moving, renaming these things always looks the same.  Why should I build up this expectation when it's availability is spotty?  And I'm not sure why a provider isn't managing this - modules are stored on the filesystem anyway, in a few specific places, and outside of using them you have all the basic provider operations: create, delete, rename, etc.  Having a provider around them should be a no-brainer.  The fact that one doesn't exist tells me that either it's too much effort (which having done so a few times I can say is probably the case) or goes against the grain of powershell "philosophy of use".

Oh well, it's still CTP3, maybe they'll have it in the RTM, right?  Or maybe I just don't "get" when something should have a provider and when it shouldn't.  Am I missing the point, or is this a case of powershell not eating its own dogfood?


About two seconds after positing this I saw this line at the top of the Modules module.psm1 file:

# Create a drive for My Modules
New-PsDrive -Scope Global -Name MyMod -PSProvider FileSystem -Root (($env:PSMODULEPATH -split ";")[0]) 

which meets my general spelunking needs.


foot | mouth;