Taking on PowerShell one cmdlet at a time
Share this post: This is part of an ongoing blog series by Adam Gordon. Adam will walk through each PowerShell command every week, explaining when and how to use them. Adam will be covering Get-PSProvider this week.
When should you use Get-PSProvider
The Get-PSProvider cmdlet retrieves the PowerShell providers for the current session. You can either get a specific drive or all of the drives in the session.
PowerShell providers allow you to access a variety data stores just like file system drives.
What version of PowerShell do I use?
Get the PowerShell Version for your machine
$PSVersionTable
This command displays the PowerShell version information for your machine.
How to use Get-PSProvider
Display a list all available providers
Get-PSProvider
This command displays a complete list of available PowerShell providers.
Display a list all PowerShell providers that start with specific letters:
This command displays a listing of all PowerShell providers whose names begin with the letter r.
Get-PSProvider f*, r* | Format-List
Find snap-ins and modules that add providers to your session.
This command locates the PowerShell snap ins or modules that added providers for your session. All PowerShell elements, including providers originate in a snap in or module.
This command uses the PSSnapin, and Module properties of ProviderInfo objects that Get-PSProvider returns. These properties contain the name and module of the snap-in that adds the provider.
The command retrieves all the session providers and formats them into a table with their Name, Module and PSSnapin values.
Format-Table name, module, pssnapin -auto
Find the path to the Home property of your file system provider.
This example shows that a tilde symbol (), is used to indicate the value of the Home property for the FileSystem provider.
The Home property value is optional, but for the FileSystem provider, it is defined as $env:homedrive\$env:homepath or $home.
Resolve-Path ~
(get-psprovider FileSystem).home
Get-Service: Last week’s command
Do you need PowerShell training? ITProTV offers PowerShell online IT training courses.