🎓 A1Learner
🔍
0 of 47 lessons completed

PowerShell Providers

A provider is a data store that PowerShell exposes like a drive. It lets you browse settings, variables, and files with the same commands.

List the provider names

Sort the names and join them into one line.

(Get-PSProvider | Sort-Object Name | Select-Object -ExpandProperty Name) -join ", "

List the drive names

Drives are what you actually navigate, and their names come from the providers.

(Get-PSDrive | Sort-Object Name | Select-Object -ExpandProperty Name) -join ", "

Drives from one provider

Filter drives to one provider to see which drives it supplies.

(Get-PSDrive -PSProvider FileSystem | Sort-Object Name | Select-Object -ExpandProperty Name) -join ", "

Example

$providers = (Get-PSProvider | Sort-Object Name | Select-Object -ExpandProperty Name) -join ", "
$drives = (Get-PSDrive | Sort-Object Name | Select-Object -ExpandProperty Name) -join ", "
"Providers: $providers"
"Drives: $drives"

Key points

  • Provider: a data store that PowerShell shows as if it were a drive.
  • Use Get-PSProvider to list the providers on this machine.
  • Use Get-PSDrive to list the drives those providers supply.
  • A drive name can differ from its provider name, such as Env for the Environment provider.
  • The FileSystem provider supplies the file drives, including the root drive.

In this example, the provider names are collected into one line and the drive names into another. Reading both lines together shows the split between the data stores and the drives you navigate.

Note

the provider list on Linux differs from Windows, so always read the list instead of assuming it.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

Which command lists the providers on this machine?