Get PSDrive - PowerShell


Get-PSDrive retrieves information about PowerShell drives. It provides details about mapped network drives, special drives, or custom drives created by applications or users.


Get-PSDrive [-Name] <string> [-Scope <string>] [-ErrorAction <string>] [-ErrorVariable <string>] [-OutVariable <string>] [-OutBuffer <int>] [-PipelineVariable <string>]


| Option | Description |
| -Name | Filters results to include only drives with the specified name (wildcards are supported). |
| -Scope | Specifies the scope in which to search for drives. Valid values are Global (all drives), Local (drives available to the current user), or Script (drives created in the current script scope). |
| -ErrorAction | Controls how errors are handled. Valid values are Continue, Stop, SilentlyContinue, or Ignore. |
| -ErrorVariable | Stores any errors that occur during the operation into the specified variable. |
| -OutVariable | Stores the results of the command in the specified variable. |
| -OutBuffer | Sets the number of objects to buffer before writing to the output stream. |
| -PipelineVariable | Specifies the variable used to pass objects to the command from the pipeline. |


Get information about all drives:


Get information about a specific drive:

Get-PSDrive -Name C:

Get drives within the current script scope:

Get-PSDrive -Scope Script

Filter drives by name:

Get-PSDrive -Name *System*

Common Issues

Drive Not Found: Ensure the provided drive name is correct and exists in the specified scope.

Access Denied: Verify that the user has sufficient permissions to access the drive.


Combine with Get-Item:

Get-PSDrive | Get-Item

Pipe to Where-Object:

Get-PSDrive | Where-Object {$_.Name -like "N*"}
  • New-PSDrive: Creates a new PowerShell drive.
  • Remove-PSDrive: Removes a PowerShell drive.
  • Set-PSDrive: Modifies properties of an existing PowerShell drive.