Search notes:

PowerShell: Providers

A provider allows PowerShell to connect to data sources (aka data stores) as though they were file systems. Therefore, providers are especially useful if the data is hierarchical in nature, like, for example

Providers, items, locations and drives

A provider is called «provider» because it provides the PowerShell environment, notably the location and childItem cmdLet nouns the possibilty to access «locations» and «items».
A provider implements one or more drives each of which contains a (hierarchical) tree.
Within a drive, the data itself is located and accessed by a path.

Different capabilities

Different providers offer different capabilities. For example, the -filter argument of get-childItem can only be used on file system providers.
The different possible capabilities are represented by the System.Management.Automation.Provider.ProviderCapabilities enumeration.

Built-in providers

Drive Data store
alias: aliases
cert: x509 ceritificates
env: Windows environment variables
(*) File system (drives, directories, files)
function: functions
hklm: hkcu: registry
variable: Variables
wsman: WS management configuration information
Arguably, the most used provider is the FileSystem provider.

Available providers

Available providers are displayed with the get-psProvider cmdlet.

Cmdlets

In order to read, write or delete data in a data store, a data item is needed. Such an element represents, for example, a file, a directory or a registry key.
PowerShell encapuslates this functionality in the item cmdLet noun.
Each of this items is associated with and stored in hierarchically structured location, think file system path. The location cmdLet noun allows to change the current location.
The data itself that an item stores can be modified with the content cmdLet noun.
Items are also associated with properties, for example the file creation date in a drive-provider. These properties can be modified with the itemProperty cmdLet noun.
Because the locations are organized in trees, an item's child items are found with the childItem cmdLet noun.
The path noun deals with the textual representation of locations and wildcard operations.
cmdlets related to providers are

Showing the locations of the providers

foreach ($provider in (get-psProvider).name) {
   "$provider $($ExecutionContext.SessionState.Path.CurrentProviderLocation($provider))"
}

Displaying content of non-filesystem providers

With the get-content cmdlet, it is possible to show the content of items that are not stored in a filesystem provider, such as for example a function:
PS C:\> get-content function:/mkdir

TODO

help filesystem

See also

The cmdLet noun psProvider has the cmdLet get-psProvider which shows the currently available providers (in the current session).
System.Management.Automation.ProviderInfo is the .NET type of which an instance corresponds to a loaded provider.
the preference variables $LogProviderHealthEvent and $LogProviderLifecycleEvent.
The System.Management.Automation.PathIntrinsics class.

Index