header image

PowerShell Basics: 5 Providers

Posted by: | June 2, 2011 | No Comment |

Providers enable PowerShell to expose data stores in a similar manner to the file system.  The built in providers can be discovered

PS> Get-PSProvider

Name          Capabilities                  Drives
—-          ————                  ——
WSMan         Credentials                   {WSMan}
Alias         ShouldProcess                 {Alias}
Environment   ShouldProcess                 {Env}
FileSystem    Filter, ShouldProcess         {C, E, F}
Function      ShouldProcess                 {Function}
Registry      ShouldProcess, Transactions   {HKLM, HKCU}
Variable      ShouldProcess                 {Variable}
Certificate   ShouldProcess                 {cert}

The providers create PowerShell drives.  In the table above c: & d: are part of the file system.  The Registry provider adds HKLM: and HKCU: for the two most commonly used hives.

These all work.

dir c:\
dir hklm:\
dir variable:\

Other providers are available for AD, SQL Server and IIS when the appropriate modules are loaded.

There are a common set of cmdlets that should work across all providers – see

Get-Help about_core_commands

and

Get-Help about_Providers

Help is also available for each of the providers e.g.

Get-Help Registry

under: PowerShell Basics