Describes how PowerShell providers provide access to data and components that would not otherwise be easily accessible at the command line. The data is presented in a consistent format that resembles a file system drive.
PowerShell providers are Microsoft .NET Framework-based programs that make the data in a specialized data store available in PowerShell so that you can view and manage it.
The data that a provider exposes appears in a drive, and you access the data in a path like you would on a hard disk drive. You can use any of the built-in cmdlets that the provider supports to manage the data in the provider drive. And, you can use custom cmdlets that are designed especially for the data.
The providers can also add dynamic parameters to the built-in cmdlets. These are parameters that are available only when you use the cmdlet with the provider data.
PowerShell includes a set of built-in providers that you can use to access the different types of data stores.
(*) The FileSystem drives vary on each system.
Providers are typically installed via PowerShell modules. Importing the module loads the provider into your session. You cannot uninstall the built-in providers. You can uninstall providers loaded by other modules.
You can unload a provider from the current session. You can do this by using the Remove-Module cmdlet. This cmdlet does not uninstall the provider, but it makes the provider unavailable in the session.
You can also use the Remove-PSDrive cmdlet to remove any drive from the current session. This data on the drive is not affected, but the drive is no longer available in that session.
The output lists the built-in providers and the providers that you added to the session.
The following cmdlets are designed to work with the data exposed by any provider. You can use the same cmdlets in the same way to manage the different types of data that providers expose. After you learn to manage the data of one provider, you can use the same procedures with the data from any provider.
For example, the New-Item cmdlet creates a new item. In the C: drive that is supported by the FileSystem provider, you can use New-Item to create a new file or folder. In the drives that are supported by the Registry provider, you can use New-Item to create a new registry key. In the Alias: drive, you can use New-Item to create a new alias.
The primary benefit of a provider is that it exposes its data in a familiar and consistent way. The model for data presentation is a file system drive.
To use data that the provider exposes, you view it, move through it, and change it as though it were data on a hard drive. Therefore, the most important information about a provider is the name of the drive that it supports.
You can view and move through the data in a provider drive just as you would on a file system drive.
If any element in the fully qualified name includes spaces, you must enclose the name in quotation marks " ". The following example shows a fully qualified path that includes spaces.
In addition, two dots (..) refers to the directory or container directly above your current location. You can combine dots (.) and double dots (..) along with your paths to work through a provider hierarchy.
PS C:\Windows\System32> cd "..\..\Program Files"
Providers also have a Home location. This location is shared by all PSDrives backed by the provider. It can be retrieved by viewing the Home property of the provider.
The FileSystem provider is the only provider that has a default value for Home. It is the same value as $Home see about_Automatic_Variables.
You can set the Home directory for a provider, for the current session, using its property.
The ~ character can be used to represent the provider's home directory. If the provider does not have a Home location set, you will see an error.
location, call "(get-psprovider 'Certificate').Home = 'path'".
Dynamic parameters are cmdlet parameters that are added to a cmdlet by a provider. These parameters are available only when the cmdlet is used with the provider that added them.
For example, the Cert: drive adds the CodeSigningCert parameter to the Get-Item and Get-ChildItem cmdlets. You can use this parameter only when you use Get-Item or Get-ChildItem in the Cert: drive.
Although all provider data appears in drives, and you use the same methods to move through them, the similarity stops there. The data stores that the provider exposes can be as varied as Active Directory locations and Microsoft Exchange Server mailboxes.