Shell – psprovider in powershell


I am new to PowerShell and trying to understand the concept of psprovider. I know I can use Get-PSProvider to show a list of available psproviders

All of the help I am finding, assumes I know things that I don't. Looking for a basic explanation of psprovider.

Best Answer

This is from the help file for Get-PSProvider:

Among other things, Windows PowerShell providers determine which 
data stores you can navigate through.

There are two major concepts buried in here. The first is the concept of a data store or, if you like, a container. The second is the concept of navigating.

The concept of data store is basic to operating on data. If you've done any work with scripting or programming, you're familiar with variables. In fact, variables are one of the kinds of data stores listed by Get-PSProvider. If you've done any work with databases or websites, you're familiar with other kinds of data stores. A second kind of navigable data store listed for you is a file system. If you've done any work with Windows, you're familiar with folders and files, and even with navigating through folders and subfolders. Folders are called directories in Powershell, but it's the same concept.

The Registry is a different kind of data store.

What's new to me, and perhaps to you, is the idea of generalizing all of these different kinds of data stores into a general superclass, and then defining certain operations on the entire superclass.

For example, Get-ChildItem is a basic navigation operation that allows you to traverse a tree of containers arranged in a hierarchy. But instead of implementing a specialized GCI for files, and another one for Registry entries, and another one for variables, and so on, they chose to implement a single GCI that could be adapted for use with any of those three, and several others.

This is just the beginning of the concepts, but I hope it helps.