PowerShell Get-PSProvider

An Introduction Get-PSProvider

I find the best way to explain PowerShell's Providers is to start with the filesystem.  I understand how Get-ChildItem views the  C:\ drive; and I see how to extend the filesystem to include network drives.

Now it's only a short step to appreciate how the registry could be a provider, especially when I see the results of:
Get-ChildItem HKLM:\System.

Topics for Windows PowerShell Providers


List PowerShell's PSProviders

This is how to research Providers, observe how PowerShell refer to them as drives.

# Enumerate PowerShell's Providers

Name        Drives 
---- ------
Alias {Alias} Environment {Env}
FileSystem {C, D, E, F...}
Function {Function}
Registry {HKLM, HKCU}
Variable {Variable}
Certificate {Cert} WSMan {WSMan}

Techniques to Access the Provider's Drive

Using Get-ChildItem you can access the values under 'Drives'; but with this method using the 'Name' does not work.  For example, Get-ChildItem Filesystem: produces an error, but Get-ChildItem C: works. My point is that you need Get-ChildItem Env: and Get-ChildItem HKLM:\

Let us use Variable: as our example

# Working with PowerShell providers
Get-ChildItem Variable:

Note 1: Remember the colon: furthermore, there is no need for a $sign to access any of the Providers.  Get-ChildItem $Variable won't work, just as Set-Location $C:\ would also produce an error.

Note 2: Of all the PSProviders, I found the 'Variable': drive the most interesting.

Alternative Method Using the Provider's Name

Here is a filesystem example starting with Get-PSProvider, piping into Select-Object, and then using the -ExpandProperties parameter.

Get-PSProvider Filesystem | Select-Object -ExpandProperty drives

Note 3: You can get a list of all drives for all providers by omitting 'Filesystem' in the above example.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds' Network Performance Monitor will help you discover what's happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds' Network Performance Monitor

The Environmental Variable Provider - Env:

It's easy to forget the full range of built-in environmental variables, therefore, let us employ PowerShell to list what you can see in the Control Panel - Advanced system settings:

Get-ChildItem Env:

Name                   	Value 
---- ----------------
APPDATA C:\Users\Guy\AppData\Roaming
CommonProgramFiles C:\Program Files\Common Files
CommonProgramFiles(x86) C:\Program Files (x86)\Common Files
CommonProgramW6432 C:\Program Files\Common Files
ComSpec C:\Windows\system32\cmd.exe
LOCALAPPDATA C:\Users\Guy\AppData\Local
OS Windows_NT
Path C:\Program Files\Common Files\..... PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.JS;...... PROCESSOR_ARCHITECTURE AMD64
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 37 Stepping 5, Genuine
ProgramData C:\ProgramData
ProgramFiles C:\Program Files
ProgramFiles(x86) C:\Program Files (x86)
ProgramW6432 C:\Program Files
PSModulePath C:\Users\Guy\Documents\WindowsPowerShell
PUBLIC C:\Users\Public
SystemDrive C: SystemRoot C:\Windows
TEMP C:\Users\Guy\AppData\Local\Temp
TMP C:\Users\Guy\AppData\Local\Temp
windir C:\Windows

Note 4: To see how many Windows environment variables you have try:
(Get-ChildItem Env:).count

Note 5: Environmental variables in 'Proper' case are the newer .Net and PowerShell variables, whereas those in UPPERCASE are older Microsoft (or possibly UNIX) style variables.

See more on PowerShell PSDrives ยป

Summary of PowerShell Get-PSProvider

Here is a cmdlet which not only reveals the filesystem drives, but also the registry hives, and Environmental variables.

If you like this page then please share it with your friends


See more Windows PowerShell  examples of variables

Syntax   • PowerShell Variables   • Get-PSProvider   • PowerShell Dollar Variable

PowerShell Functions   • Get-PSDrive   • PowerShell New-PSDrive   • Remove-PSDrive

PowerShell Home   • Foreach loops   • PowerShell Foreach   • Foreach-Object cmdlet

Please email me if you have a better example script.  Also please report any factual mistakes, grammatical errors or broken links, I will be happy to  correct the fault.



Custom Search

Site Home

Guy Recommends: WMI Monitor for PowershellSolarwinds WMI Monitor

Windows Management Instrumentation (WMI) is most useful for PowerShell scripting.

SolarWinds have produced this Free WMI Monitor to take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

Author: Guy Thomas Copyright © 1999-2017 Computer Performance LTD All rights reserved.

Please report a broken link, or an error to: