This is a part of an on-going blog series written by Adam Gordon. Each week, Adam will walk you through a PowerShell command, showing you when and how to use each one. This week, Adam covers Get-PSProvider.
When to use Get-PSProvider?
The Get-PSProvider cmdlet gets the PowerShell providers in the current session. You can get a particular drive or all drives in the session.
PowerShell providers let you access a variety of data stores as though they were file system drives.
What version of PowerShell am I using?
Get the PowerShell Version from your machine:
This command shows you the PowerShell version information on your machine.
How to use Get-PSProvider?
Display a list of all available providers:
This command displays a list of all available PowerShell providers.
Display a list of all PowerShell providers that begin with specified letters:
This command displays a list of all PowerShell providers with names that begin with the letter for r.
Get-PSProvider f*, r* | Format-List
Find snap-ins or module that added providers to your session:
This command finds the PowerShell snap-ins or modules that added providers to your session. All PowerShell elements, including providers, originate in a snap-in or in a module.
This command uses the PSSnapin and Module properties of the ProviderInfo object that Get-PSProvider returns. The values of these properties contain the name of the snap-in or module that adds the provider.
The command gets all of the providers in the session and formats them in a table with the values of their Name, Module, and PSSnapin properties.
Get-PSProvider | Format-Table name, module, pssnapin -auto
Resolve the path of the Home property of the file system provider:
This example shows that the tilde symbol (~) represents the value of the Home property of the FileSystem provider.
The Home property value is optional, but for the FileSystem provider, it is defined as $env:homedrive\$env:homepath or $home.
Learn last week’s command: Get-Service.
Need PowerShell training? Check out ITProTV’s PowerShell online IT training courses.