Get-PSDrive

Get drive information.

Syntax
      Get-PSDrive { [[-name] string[]] | [-literalName] string[]  }
[-Force] [-pSProvider string[]] [-scope string] [-UseTransaction] [CommonParameters] Key -name string Get only the specified drives. Type the drive name or letter without a colon (:), separate multiple names with commas. -literalName string The Drive name which will be used exactly as typed. No characters are interpreted as wildcards. If the name includes escape characters, enclose it in single quotation marks. -PSProvider Get only the drives supported by the specified PowerShell provider. Type the name of a provider, such as: FileSystem, Registry, or Certificate. -scope The scope within which to search for the drive. Valid values are "Global", "Local", or "Script", or a number relative to the current scope (0 through the number of scopes, where 0 is the current scope and 1 is its parent). "Local" is the default. For more information, see about_Scopes. -UseTransaction Include the command in the active transaction.

Standard Aliases for Get-PSDrive: gdr

Get-PSDrive gets the PowerShell drives in the current session. You can get a particular drive or all drives in the console.

Get-PSDrive gets the following drive types:

Examples

Display information about all currently visible drives:

PS C:\> Get-PSDrive

Display information for all FileSystem drives:

PS C:\> Get-PSDrive -psprovider filesystem

Display the description of a PowerShell drive on your system:

PS C:\> (Get-PSDrive DriveName).description

Display all the currently mapped FileSystem drives for this user session by querying the registry:

PS C:\> Get-ChildItem -path HKCU:\Network -recurse |
Get-ItemProperty | Select-Object pschildname, remotepath | Out-String

Display information for drives with names that begin with HK (registry: HKLM, HKCU etc):

PS C:\> Get-PSDrive HK*

"Heaven wheels above you, displaying to you her eternal glories, and still your eyes are on the ground” ~ Dante Alighieri

Related PowerShell Cmdlets

New-PSDrive - Install a new drive on the machine.
Remove-PSDrive - Remove a provider/drive from its location.
Get-SMBMapping - Get Mapped SMB drives.
Get-Ciminstance win32_logicaldisk.
Get-Ciminstance win32_networkconnection.
[System.IO.DriveInfo]::getdrives()
Equivalent bash command: ln - Make links between files.


 
Copyright © 1999-2024 SS64.com
Some rights reserved