TExcelTAD
Home › PowerShell › PowerShell Providers & Drives

PowerShell Providers & Drives

In PowerShell, the file system is just one kind of data store. Providers present other stores, such as environment variables, variables, functions, aliases, the Windows registry and certificates, as if they were drives with folders and items. The same cmdlets (Get-ChildItem, Get-Item, New-Item, Remove-Item, Test-Path) work on all of them.

Listing providers and drives

powershell · try it yourself
Get-PSProvider | ForEach-Object Name
'---'
Get-PSDrive | Sort-Object Name | ForEach-Object { '{0,-10} {1}' -f $_.Name, $_.Provider.Name }
Alias
Environment
FileSystem
Function
Variable
---
/          FileSystem
Alias      Alias
Env        Environment
Function   Function
Temp       FileSystem
Variable   Variable

On Linux the root of the file system is the drive /; on Windows you'd see C, D and so on. Windows also has the Registry (HKLM:, HKCU:), Certificate (Cert:) and WSMan providers. Temp: (PowerShell 7.1+) points at the system's temporary folder everywhere.

One set of cmdlets, many stores

Here the same item cmdlets work on four different providers:

powershell · try it yourself
# FileSystem
Set-Content ./note.txt 'hello'
Test-Path ./note.txt

# Environment
New-Item -Path Env:DEMO_COLOR -Value 'blue' | Out-Null
(Get-Item Env:DEMO_COLOR).Value

# Variable
New-Item -Path Variable:answer -Value 42 | Out-Null
$answer

# Function
New-Item -Path Function:Get-Hi -Value { 'hi from the Function: drive' } | Out-Null
Get-Hi
Get-ChildItem Function:Get-Hi | ForEach-Object Name
True
blue
42
hi from the Function: drive
Get-Hi

That's why a function can be deleted with Remove-Item Function:Get-Hi and an alias listed with Get-ChildItem Alias:.

Provider-qualified paths

You can include the drive in a path to work with another provider without changing location, and Set-Location moves into any drive:

powershell · try it yourself
Get-ChildItem Alias: | Where-Object Name -in 'gci', 'gc', 'select' |
    Sort-Object Name | ForEach-Object { "$($_.Name) -> $($_.Definition)" }

Set-Location Variable:
(Get-Location).Path
Get-Item PSEdition | ForEach-Object Value
Set-Location /tmp
gc -> Get-Content
gci -> Get-ChildItem
select -> Select-Object
Variable:/
Core

Creating your own drives

New-PSDrive creates a shortcut drive to a long path. Drives you create last until the session ends (add them to your profile to keep them):

powershell · try it yourself
New-Item -ItemType Directory ./company/projects/2026/website -Force | Out-Null
Set-Content ./company/projects/2026/website/todo.txt 'launch'

New-PSDrive -Name Proj -PSProvider FileSystem -Root /tmp/company/projects/2026 | Out-Null
Get-ChildItem Proj:/website | ForEach-Object Name
Get-Content Proj:/website/todo.txt
(Resolve-Path Proj:/website).ProviderPath
Remove-PSDrive Proj
todo.txt
launch
/tmp/company/projects/2026/website

.ProviderPath translates the drive path back into the real file-system path, which is what you'd pass to external programs (they don't know PowerShell drives).

Item properties

Get-ItemProperty and Set-ItemProperty read and change properties of items. For files that means attributes like the last write time:

powershell · try it yourself
Set-Content ./build.txt 'v1'
Set-ItemProperty ./build.txt -Name LastWriteTime -Value ([datetime]'2026-01-02 03:04:05')
(Get-ItemProperty ./build.txt).LastWriteTime.ToString('yyyy-MM-dd HH:mm:ss')
(Get-ItemProperty ./build.txt -Name Length).Length
2026-01-02 03:04:05
3

The registry (Windows only)

On Windows, the same cmdlets browse and edit the registry. Registry keys are items (folders); values are item properties:

text
PS C:\> Get-ChildItem HKCU:\Software | Select-Object -First 3 PSChildName
PSChildName
-----------
Microsoft
Policies
Classes

PS C:\> Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' |
>>     Select-Object ProductName, DisplayVersion
ProductName           DisplayVersion
-----------           --------------
Windows 11 Pro        24H2

PS C:\> New-Item -Path HKCU:\Software\Contoso -Force
PS C:\> Set-ItemProperty -Path HKCU:\Software\Contoso -Name InstallDir -Value 'C:\Tools'
PS C:\> Get-ItemPropertyValue -Path HKCU:\Software\Contoso -Name InstallDir
C:\Tools

(Sample output from a Windows 11 machine; this cannot run on Linux.) Always test registry changes with -WhatIf first and back up keys before editing.

Test yourself

Which provider exposes environment variables?

  1. FileSystem
  2. Environment (drive Env:)
  3. Registry
  4. Variable

How do you delete the function Get-Temp with an item cmdlet?

  1. Remove-Item Function:Get-Temp
  2. Remove-Function Get-Temp
  3. Delete-Item Get-Temp
  4. Remove-Item Get-Temp.ps1

On Windows, what represents a registry value in provider terms?

  1. An item
  2. A drive
  3. An item property
  4. A provider