Get-PSDrive
Use Get-PSDrive to list the drives available in the session, including those that are not filesystems.
Documentation: Microsoft Learn — Get-PSDrive
Syntax
See the command anatomy
Inspect this authored example with fictional data in the bounded browser model. The numbered stages show how its objects change.
Get-PSDrive | Select-Object Name, Provider, Root- Stage 1Get-PSDrive
Positional values or no named parameters - Stage 2Select-Object
Positional values or no named parameters
Try it
Browser simulation · fictional data; no changes to your computer.
Follow the objects
Run the command to inspect each stage.
Examples
Select Name, Provider, Root
Show reference output
Illustrative output · values vary by environment
Name Provider Root -------- ----------- ------------------ C FileSystem C:\ D FileSystem D:\ HKCU Registry HKEY_CURRENT_USER HKLM Registry HKEY_LOCAL_MACHINE Env Environment Function Function Variable Variable Alias Alias
Get-PSDrive -PSProvider FileSystem
Show reference output
Illustrative output · values vary by environment
Name Used Free ---- ---- ---- C 313317867520 197890842624 D 342523641856 657881497600
Get-PSDrive -Name C
Show reference output
Illustrative output · values vary by environment
Name Used (GB) Free (GB) Provider Root ---- --------- --------- -------- ---- C 291.8 184.3 FileSystem C:\
Parameters
Parameter definitions:
-Name-PSProvider-Scope
Practical use and troubleshooting
Practical scenario: Use Get-PSDrive when you need to list the drives available in the session, including those that are not filesystems. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: A drive missing in another process may have been created only in the original session. Inspect provider and scope and do not assume a session-only drive is available to a scheduled task. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Get-Location. Get-PSDrive lists drives exposed by PowerShell providers; Get-Location identifies the current provider location. A PSDrive is not necessarily a physical disk or a persistent Windows mapping. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Get-PSDrive Use Get-PSDrive to list the drives available in the session, including those that are not filesystems.
Next: Get-PSSession